bharat saraswal
Committed by Gerrit Code Review

UT test cases for PCEP report, Label update, TE report messages and tlvs.

Change-Id: I7b22766e330c7e5936323d44e78d63fd653a6e45
Showing 20 changed files with 4426 additions and 116 deletions
......@@ -78,7 +78,7 @@ public final class PcepFactories {
factory = org.onosproject.pcepio.protocol.ver1.PcepFactoryVer1.INSTANCE;
break;
default:
throw new IllegalArgumentException("Unknown Packet version: " + packetVersion);
throw new PcepParseException("Unknown Packet version: " + packetVersion);
}
return factory.getReader().readFrom(bb);
}
......
......@@ -27,8 +27,15 @@ import org.onosproject.pcepio.protocol.PcepError;
import org.onosproject.pcepio.protocol.PcepErrorMsg;
import org.onosproject.pcepio.protocol.PcepErrorObject;
import org.onosproject.pcepio.protocol.PcepFactory;
import org.onosproject.pcepio.protocol.PcepFecObjectIPv4Adjacency;
import org.onosproject.pcepio.protocol.PcepInitiateMsg;
import org.onosproject.pcepio.protocol.PcepIroObject;
import org.onosproject.pcepio.protocol.PcepKeepaliveMsg;
import org.onosproject.pcepio.protocol.PcepLabelObject;
import org.onosproject.pcepio.protocol.PcepLabelRangeObject;
import org.onosproject.pcepio.protocol.PcepLabelRangeResvMsg;
import org.onosproject.pcepio.protocol.PcepLabelUpdate;
import org.onosproject.pcepio.protocol.PcepLabelUpdateMsg;
import org.onosproject.pcepio.protocol.PcepLspObject;
import org.onosproject.pcepio.protocol.PcepLspaObject;
import org.onosproject.pcepio.protocol.PcepMessage;
......@@ -37,7 +44,10 @@ import org.onosproject.pcepio.protocol.PcepMetricObject;
import org.onosproject.pcepio.protocol.PcepMsgPath;
import org.onosproject.pcepio.protocol.PcepOpenMsg;
import org.onosproject.pcepio.protocol.PcepOpenObject;
import org.onosproject.pcepio.protocol.PcepReportMsg;
import org.onosproject.pcepio.protocol.PcepRroObject;
import org.onosproject.pcepio.protocol.PcepSrpObject;
import org.onosproject.pcepio.protocol.PcepStateReport;
import org.onosproject.pcepio.protocol.PcepUpdateMsg;
import org.onosproject.pcepio.protocol.PcepUpdateRequest;
import org.onosproject.pcepio.protocol.PcepVersion;
......@@ -72,9 +82,8 @@ public class PcepFactoryVer1 implements PcepFactory {
}
@Override
public org.onosproject.pcepio.protocol.PcepReportMsg.Builder buildReportMsg() {
// TODO Auto-generated method stub
return null;
public PcepReportMsg.Builder buildReportMsg() {
return new PcepReportMsgVer1.Builder();
}
@Override
......@@ -113,9 +122,8 @@ public class PcepFactoryVer1 implements PcepFactory {
}
@Override
public org.onosproject.pcepio.protocol.PcepRroObject.Builder buildRroObject() {
// TODO Auto-generated method stub
return null;
public PcepRroObject.Builder buildRroObject() {
return new PcepRroObjectVer1.Builder();
}
@Override
......@@ -124,9 +132,8 @@ public class PcepFactoryVer1 implements PcepFactory {
}
@Override
public org.onosproject.pcepio.protocol.PcepIroObject.Builder buildIroObject() {
// TODO Auto-generated method stub
return null;
public PcepIroObject.Builder buildIroObject() {
return new PcepIroObjectVer1.Builder();
}
@Override
......@@ -145,9 +152,8 @@ public class PcepFactoryVer1 implements PcepFactory {
}
@Override
public org.onosproject.pcepio.protocol.PcepStateReport.Builder buildPcepStateReport() {
// TODO Auto-generated method stub
return null;
public PcepStateReport.Builder buildPcepStateReport() {
return new PcepStateReportVer1.Builder();
}
@Override
......@@ -166,21 +172,18 @@ public class PcepFactoryVer1 implements PcepFactory {
}
@Override
public org.onosproject.pcepio.protocol.PcepLabelUpdateMsg.Builder buildPcepLabelUpdateMsg() {
// TODO Auto-generated method stub
return null;
public PcepLabelUpdateMsg.Builder buildPcepLabelUpdateMsg() {
return new PcepLabelUpdateMsgVer1.Builder();
}
@Override
public org.onosproject.pcepio.protocol.PcepLabelUpdate.Builder buildPcepLabelUpdateObject() {
// TODO Auto-generated method stub
return null;
public PcepLabelUpdate.Builder buildPcepLabelUpdateObject() {
return new PcepLabelUpdateVer1.Builder();
}
@Override
public org.onosproject.pcepio.protocol.PcepLabelObject.Builder buildLabelObject() {
// TODO Auto-generated method stub
return null;
public PcepLabelObject.Builder buildLabelObject() {
return new PcepLabelObjectVer1.Builder();
}
@Override
......@@ -194,9 +197,8 @@ public class PcepFactoryVer1 implements PcepFactory {
}
@Override
public org.onosproject.pcepio.protocol.PcepFecObjectIPv4Adjacency.Builder buildFecIpv4Adjacency() {
// TODO Auto-generated method stub
return null;
public PcepFecObjectIPv4Adjacency.Builder buildFecIpv4Adjacency() {
return new PcepFecObjectIPv4AdjacencyVer1.Builder();
}
@Override
......@@ -210,15 +212,13 @@ public class PcepFactoryVer1 implements PcepFactory {
}
@Override
public org.onosproject.pcepio.protocol.PcepLabelRangeObject.Builder buildPcepLabelRangeObject() {
// TODO Auto-generated method stub
return null;
public PcepLabelRangeObject.Builder buildPcepLabelRangeObject() {
return new PcepLabelRangeObjectVer1.Builder();
}
@Override
public org.onosproject.pcepio.protocol.PcepLabelRangeResvMsg.Builder buildPcepLabelRangeResvMsg() {
// TODO Auto-generated method stub
return null;
public PcepLabelRangeResvMsg.Builder buildPcepLabelRangeResvMsg() {
return new PcepLabelRangeResvMsgVer1.Builder();
}
}
......
......@@ -42,6 +42,7 @@ public abstract class PcepMessageVer1 {
static final byte CLOSE_MSG_TYPE = 0x7;
static final byte ERROR_MSG_TYPE = 0x6;
static final byte LABEL_UPDATE_MSG_TYPE = 0xD;
static final byte LABEL_RANGE_RESV_MSG_TYPE = 0xF;
public static final int SHIFT_FLAG = 5;
static final int MINIMUM_COMMON_HEADER_LENGTH = 4;
......@@ -86,7 +87,7 @@ public abstract class PcepMessageVer1 {
log.debug("REPORT MESSAGE is received");
// message type value 10 means it is Report message
// return
// TODO: Read Report message from channel buffer.
return PcepReportMsgVer1.READER.readFrom(cb.readBytes(length));
case UPDATE_MSG_TYPE:
log.debug("UPDATE MESSAGE is received");
//message type value 11 means it is Update message
......@@ -103,12 +104,17 @@ public abstract class PcepMessageVer1 {
log.debug("TE REPORT MESSAGE is received");
// message type value 14 means it is TE REPORT message
// return
// TODO: Read TE Report message from channel buffer.
return PcepTEReportMsgVer1.READER.readFrom(cb.readBytes(length));
case LABEL_UPDATE_MSG_TYPE:
log.debug("LABEL UPDATE MESSAGE is received");
// message type value 13 means it is LABEL UPDATE message
// return
// TODO: Read Label update message from channel buffer.
return PcepLabelUpdateMsgVer1.READER.readFrom(cb.readBytes(length));
case LABEL_RANGE_RESV_MSG_TYPE:
log.debug("LABEL RANGE RESERVE MESSAGE is received");
// message type value 15 means it is LABEL RANGE RESERVE message
// return
return PcepLabelRangeResvMsgVer1.READER.readFrom(cb.readBytes(length));
default:
throw new PcepParseException("ERROR: UNKNOWN MESSAGE is received. Msg Type: " + type);
}
......
/*
* 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 com.google.common.testing.EqualsTester;
import org.junit.Test;
import org.onosproject.pcepio.types.IPv4SubObject;
/**
* Test of the IPv4SubObject.
*/
public class IPv4SubObjectTest {
private final IPv4SubObject subObj1 = IPv4SubObject.of(2, (byte) 16, (byte) 0);
private final IPv4SubObject sameAsSubObj1 = IPv4SubObject.of(2, (byte) 16, (byte) 0);
private final IPv4SubObject subObj2 = IPv4SubObject.of(3, (byte) 16, (byte) 0);
@Test
public void basics() {
new EqualsTester()
.addEqualityGroup(subObj1, sameAsSubObj1)
.addEqualityGroup(subObj2)
.testEquals();
}
}
/*
* 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 com.google.common.testing.EqualsTester;
import org.junit.Test;
import org.onosproject.pcepio.types.IPv6SubObject;
/**
* Test of the IPv6SubObject.
*/
public class IPv6SubObjectTest {
private final byte[] b1 = new byte[] {(byte) 0xFE, (byte) 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x02,
(byte) 0xB3, (byte) 0xFF, (byte) 0xFE, 0x1E, (byte) 0x83, 0x29, 0x00, 0x02, 0x00, 0x00};
private final byte[] b2 = new byte[] {(byte) 0xFE, (byte) 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x02,
(byte) 0xB3, (byte) 0xFF, (byte) 0xFE, 0x1E, (byte) 0x83, 0x30, 0x00, 0x02, 0x00, 0x00 };
private final IPv6SubObject subObj1 = IPv6SubObject.of(b1);
private final IPv6SubObject sameAsSubObj1 = IPv6SubObject.of(b1);
private final IPv6SubObject subObj2 = IPv6SubObject.of(b2);
@Test
public void basics() {
new EqualsTester().addEqualityGroup(subObj1, sameAsSubObj1).addEqualityGroup(subObj2).testEquals();
}
}
/*
* 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 com.google.common.testing.EqualsTester;
import org.junit.Test;
import org.onosproject.pcepio.types.LabelSubObject;
/**
* Test of the LabelSubObject.
*/
public class LabelSubObjectTest {
private final LabelSubObject subObj1 = LabelSubObject.of((byte) 0, (byte) 1, 20);
private final LabelSubObject sameAsSubObj1 = LabelSubObject.of((byte) 0, (byte) 1, 20);
private final LabelSubObject subObj2 = LabelSubObject.of((byte) 0, (byte) 1, 30);
@Test
public void basics() {
new EqualsTester()
.addEqualityGroup(subObj1, sameAsSubObj1)
.addEqualityGroup(subObj2)
.testEquals();
}
}
/* * 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 com.google.common.testing.EqualsTester; import org.junit.Test; import java.util.LinkedList; import org.onosproject.pcepio.types.LocalTENodeDescriptorsTLV;import org.onosproject.pcepio.types.AutonomousSystemTlv;import org.onosproject.pcepio.types.BGPLSidentifierTlv;import org.onosproject.pcepio.types.PcepValueType; /** * Test of the LocalTENodeDescriptorsTlv. */public class LocalTENodeDescriptorsTlvTest { private final AutonomousSystemTlv baAutoSysTlvRawValue1 = new AutonomousSystemTlv(1); private final BGPLSidentifierTlv baBgplsIdRawValue1 = new BGPLSidentifierTlv(1); private final AutonomousSystemTlv baAutoSysTlvRawValue2 = new AutonomousSystemTlv(2); private final BGPLSidentifierTlv baBgplsIdRawValue2 = new BGPLSidentifierTlv(2); private final LinkedList<PcepValueType> llNodeDescriptorSubTLVs1 = new LinkedList<PcepValueType>(); private final boolean a = llNodeDescriptorSubTLVs1.add(baAutoSysTlvRawValue1); private final boolean b = llNodeDescriptorSubTLVs1.add(baBgplsIdRawValue1); private final LinkedList<PcepValueType> llNodeDescriptorSubTLVs2 = new LinkedList<PcepValueType>(); private final boolean c = llNodeDescriptorSubTLVs2.add(baAutoSysTlvRawValue2); private final boolean d = llNodeDescriptorSubTLVs2.add(baBgplsIdRawValue2); private final LocalTENodeDescriptorsTLV tlv1 = LocalTENodeDescriptorsTLV.of(llNodeDescriptorSubTLVs1); private final LocalTENodeDescriptorsTLV sameAstlv1 = LocalTENodeDescriptorsTLV.of(llNodeDescriptorSubTLVs1); private final LocalTENodeDescriptorsTLV tlv2 = LocalTENodeDescriptorsTLV.of(llNodeDescriptorSubTLVs2); @Test public void basics() { new EqualsTester().addEqualityGroup(tlv1, sameAstlv1).addEqualityGroup(tlv2).testEquals(); }}
\ No newline at end of file
......@@ -17,9 +17,7 @@ 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;
......@@ -27,58 +25,36 @@ 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() {
}
/**
* Common header, reason to close.
*
* @throws PcepParseException while parsing the PCEP message.
*/
@Test
public void closeMessageTest1() throws PcepParseException {
byte[] closeMsg = new byte[] {0x20, 0x07, 0x00, 0x0C, /* common header */
byte[] closeMsg = new byte[] {0x20, 0x07, 0x00, 0x0C,
0x0f, 0x10, 0x00, 0x08, 0x00, 0x00, 0x00, 0x02 };
byte[] testCloseMsg = {0};
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();
}
Assert.assertTrue("PcepMessage is not instance of PcepCloseMsg", message instanceof PcepCloseMsg);
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");
}
int readLen = buf.writerIndex() - 0;
testCloseMsg = new byte[readLen];
buf.readBytes(testCloseMsg, 0, readLen);
Assert.assertArrayEquals("PcTERpt messages are not equal", closeMsg, testCloseMsg);
}
}
......
......@@ -15,54 +15,38 @@
*/
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() {
}
/**
* Common header for keep alive message.
*
* @throws PcepParseException while parsing the PCEP message.
*/
@Test
public void keepaliveMessageTest1() throws PcepParseException {
byte[] keepaliveMsg = new byte[] {0x20, 0x02, 0x00, 0x04 };
byte[] testKeepaliveMsg = {0};
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();
}
Assert.assertTrue("PcepMessage is not instance of PcepKeepaliveMsg", message instanceof PcepKeepaliveMsg);
if (message instanceof PcepKeepaliveMsg) {
ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
message.writeTo(buf);
testKeepaliveMsg = buf.array();
......@@ -71,16 +55,6 @@ public class PcepKeepaliveMsgTest {
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");
}
Assert.assertArrayEquals("PcTERpt messages are not equal", keepaliveMsg, testKeepaliveMsg);
}
}
......
/*
* 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.Assert;
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.PcepLabelUpdateMsg;
public class PcepLabelUpdateMsgTest {
/**
* This test case checks for
* <pce-label-download> SRP, LSP, LABEL Object.
* in PcepLabelUpdate message.
*
* @throws PcepParseException while parsing PCEP message
*/
@Test
public void labelUpdateMessageTest1() throws PcepParseException {
byte[] labelUpdate = new byte[] {0x20, 0x0D, 0x00, 0x24, // common header
0x21, 0x10, 0x00, 0x0C, // SRP Object Header
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x10,
0x20, 0x10, 0x00, 0x08, // LSP Object Header
0x00, 0x01, 0x00, 0x00,
0x23, 0x10, 0x00, 0x0C, // LABEL Object Header
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x66};
ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
buffer.writeBytes(labelUpdate);
PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
PcepMessage message = null;
message = reader.readFrom(buffer);
byte[] testLabelUpdateMsg = {0};
Assert.assertTrue("PcepMessage is not instance of PcepLabelUpdate", message instanceof PcepLabelUpdateMsg);
ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
message.writeTo(buf);
int readLen = buf.writerIndex() - 0;
testLabelUpdateMsg = new byte[readLen];
buf.readBytes(testLabelUpdateMsg, 0, readLen);
Assert.assertArrayEquals("PcepLabelUpdate messages are not equal", labelUpdate, testLabelUpdateMsg);
}
/**
* This test case checks for
* <pce-label-download> SRP, LSP, LABEL Object, LABEL Object.
* in PcepLabelUpdate message.
*
* @throws PcepParseException while parsing PCEP message
*/
@Test
public void labelUpdateMessageTest2() throws PcepParseException {
byte[] labelUpdate = new byte[] {0x20, 0x0D, 0x00, 0x30, // common header
0x21, 0x10, 0x00, 0x0C, // SRP Object Header
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x10,
0x20, 0x10, 0x00, 0x08, // LSP Object Header
0x00, 0x01, 0x00, 0x00,
0x23, 0x10, 0x00, 0x0C, // LABEL Object Header
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x66,
0x23, 0x10, 0x00, 0x0C, // LABEL Object Header
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x77};
ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
buffer.writeBytes(labelUpdate);
PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
PcepMessage message = null;
message = reader.readFrom(buffer);
byte[] testLabelUpdateMsg = {0};
Assert.assertTrue("PcepMessage is not instance of PcepLabelUpdate", message instanceof PcepLabelUpdateMsg);
ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
message.writeTo(buf);
int readLen = buf.writerIndex() - 0;
testLabelUpdateMsg = new byte[readLen];
buf.readBytes(testLabelUpdateMsg, 0, readLen);
Assert.assertArrayEquals("PcepLabelUpdate messages are not equal", labelUpdate, testLabelUpdateMsg);
}
/**
* This test case checks for
* <pce-label-map> SRP, LABEL, FEC Object.
* in PcepLabelUpdate message.
*
* @throws PcepParseException while parsing PCEP message
*/
@Test
public void labelUpdateMessageTest3() throws PcepParseException {
byte[] labelUpdate = new byte[] {0x20, 0x0D, 0x00, 0x24, // common header
0x21, 0x10, 0x00, 0x0C, // SRP Object Header
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x10,
0x23, 0x10, 0x00, 0x0C, // LABEL Object Header
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x66,
0x24, 0x10, 0x00, 0x08, // FEC Object Header
0x0A, 0x0A, 0x0B, 0x0B};
ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
buffer.writeBytes(labelUpdate);
PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
PcepMessage message = null;
message = reader.readFrom(buffer);
byte[] testLabelUpdateMsg = {0};
Assert.assertTrue("PcepMessage is not instance of PcepLabelUpdate", message instanceof PcepLabelUpdateMsg);
ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
message.writeTo(buf);
int readLen = buf.writerIndex() - 0;
testLabelUpdateMsg = new byte[readLen];
buf.readBytes(testLabelUpdateMsg, 0, readLen);
Assert.assertArrayEquals("PcepLabelUpdate messages are not equal", labelUpdate, testLabelUpdateMsg);
}
/**
* This test case checks for
* <pce-label-download> SRP, LSP, LABEL, LABEL, <pce-label-download> SRP, LSP, LABEL
* in PcepLabelUpdate message.
*
* @throws PcepParseException while parsing PCEP message
*/
@Test
public void labelUpdateMessageTest4() throws PcepParseException {
byte[] labelUpdate = new byte[] {0x20, 0x0D, 0x00, 0x50, // common header
0x21, 0x10, 0x00, 0x0C, // SRP Object Header
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x10,
0x20, 0x10, 0x00, 0x08, // LSP Object Header
0x00, 0x01, 0x00, 0x00,
0x23, 0x10, 0x00, 0x0C, // LABEL Object Header
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x66,
0x23, 0x10, 0x00, 0x0C, // LABEL Object Header
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x77,
0x21, 0x10, 0x00, 0x0C, // SRP Object Header
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x11,
0x20, 0x10, 0x00, 0x08, // LSP Object Header
0x00, 0x02, 0x00, 0x00,
0x23, 0x10, 0x00, 0x0C, // LABEL Object Header
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x44};
ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
buffer.writeBytes(labelUpdate);
PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
PcepMessage message = null;
message = reader.readFrom(buffer);
byte[] testLabelUpdateMsg = {0};
Assert.assertTrue("PcepMessage is not instance of PcepLabelUpdate", message instanceof PcepLabelUpdateMsg);
ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
message.writeTo(buf);
int readLen = buf.writerIndex() - 0;
testLabelUpdateMsg = new byte[readLen];
buf.readBytes(testLabelUpdateMsg, 0, readLen);
Assert.assertArrayEquals("PcepLabelUpdate messages are not equal", labelUpdate, testLabelUpdateMsg);
}
/**
* This test case checks for
* <pce-label-map> SRP, LABEL, FEC, <pce-label-map> SRP, LABEL, FEC.
* in PcepLabelUpdate message.
*
* @throws PcepParseException while parsing PCEP message
*/
@Test
public void labelUpdateMessageTest5() throws PcepParseException {
byte[] labelUpdate = new byte[] {0x20, 0x0D, 0x00, 0x44, // common header
0x21, 0x10, 0x00, 0x0C, // SRP Object Header
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x10,
0x23, 0x10, 0x00, 0x0C, // LABEL Object Header
0x00, 0x00, 0x00, 0x01,
0x00, 0x00, 0x00, 0x66,
0x24, 0x10, 0x00, 0x08, // FEC Object Header
0x0A, 0x0A, 0x0B, 0x0B,
0x21, 0x10, 0x00, 0x0C, // SRP Object Header
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x11,
0x23, 0x10, 0x00, 0x0C, // LABEL Object Header
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x66,
0x24, 0x10, 0x00, 0x08, // FEC Object Header
0x0A, 0x0A, 0x0C, 0x0C};
ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
buffer.writeBytes(labelUpdate);
PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
PcepMessage message = null;
message = reader.readFrom(buffer);
byte[] testLabelUpdateMsg = {0};
Assert.assertTrue("PcepMessage is not instance of PcepLabelUpdate", message instanceof PcepLabelUpdateMsg);
ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
message.writeTo(buf);
int readLen = buf.writerIndex() - 0;
testLabelUpdateMsg = new byte[readLen];
buf.readBytes(testLabelUpdateMsg, 0, readLen);
Assert.assertArrayEquals("PcepLabelUpdate messages are not equal", labelUpdate, testLabelUpdateMsg);
}
/**
* This test case checks for
* <pce-label-download> SRP, LSP, LABEL, LABEL, <pce-label-download> SRP, LABEL, FEC.
* in PcepLabelUpdate message.
*
* @throws PcepParseException while parsing PCEP message
*/
@Test
public void labelUpdateMessageTest6() throws PcepParseException {
byte[] labelUpdate = new byte[] {0x20, 0x0D, 0x00, 0x50, // common header
0x21, 0x10, 0x00, 0x0C, // SRP Object Header
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x10,
0x20, 0x10, 0x00, 0x08, // LSP Object Header
0x00, 0x01, 0x00, 0x00,
0x23, 0x10, 0x00, 0x0C, // LABEL Object Header
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x66,
0x23, 0x10, 0x00, 0x0C, // LABEL Object Header
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x77,
0x21, 0x10, 0x00, 0x0C, // SRP Object Header
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x12,
0x23, 0x10, 0x00, 0x0C, // LABEL Object Header
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x66,
0x24, 0x10, 0x00, 0x08, // FEC Object Header
0x0A, 0x0A, 0x0D, 0x0D};
ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
buffer.writeBytes(labelUpdate);
PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
PcepMessage message = null;
message = reader.readFrom(buffer);
byte[] testLabelUpdateMsg = {0};
Assert.assertTrue("PcepMessage is not instance of PcepLabelUpdate", message instanceof PcepLabelUpdateMsg);
ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
message.writeTo(buf);
int readLen = buf.writerIndex() - 0;
testLabelUpdateMsg = new byte[readLen];
buf.readBytes(testLabelUpdateMsg, 0, readLen);
Assert.assertArrayEquals("PcepLabelUpdate messages are not equal", labelUpdate, testLabelUpdateMsg);
}
/**
* This test case checks for
* <pce-label-download> SRP, LABEL, FEC, <pce-label-download> SRP, LSP, LABEL, LABEL.
* in PcepLabelUpdate message.
*
* @throws PcepParseException while parsing PCEP message
*/
@Test
public void labelUpdateMessageTest7() throws PcepParseException {
byte[] labelUpdate = new byte[] {0x20, 0x0D, 0x00, 0x50, // common header
0x21, 0x10, 0x00, 0x0C, // SRP Object Header
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x12,
0x23, 0x10, 0x00, 0x0C, // LABEL Object Header
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x66,
0x24, 0x10, 0x00, 0x08, // FEC Object Header
0x0A, 0x0A, 0x0D, 0x0D,
0x21, 0x10, 0x00, 0x0C, // SRP Object Header
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x10,
0x20, 0x10, 0x00, 0x08, // LSP Object Header
0x00, 0x01, 0x00, 0x00,
0x23, 0x10, 0x00, 0x0C, // LABEL Object Header
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x66,
0x23, 0x10, 0x00, 0x0C, // LABEL Object Header
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x77};
ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
buffer.writeBytes(labelUpdate);
PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
PcepMessage message = null;
message = reader.readFrom(buffer);
byte[] testLabelUpdateMsg = {0};
Assert.assertTrue("PcepMessage is not instance of PcepLabelUpdate", message instanceof PcepLabelUpdateMsg);
ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
message.writeTo(buf);
int readLen = buf.writerIndex() - 0;
testLabelUpdateMsg = new byte[readLen];
buf.readBytes(testLabelUpdateMsg, 0, readLen);
Assert.assertArrayEquals("PcepLabelUpdate messages are not equal", labelUpdate, testLabelUpdateMsg);
}
/**
* This test case checks for
* <pce-label-download> SRP, LABEL, FEC, <pce-label-download> SRP, LSP, LABEL, LABEL.
* <pce-label-download> SRP, LSP, LABEL, LABEL.
* in PcepLabelUpdate message.
*
* @throws PcepParseException while parsing PCEP message
*/
@Test
public void labelUpdateMessageTest8() throws PcepParseException {
byte[] labelUpdate = new byte[] {0x20, 0x0D, 0x00, 0x7C, // common header
0x21, 0x10, 0x00, 0x0C, // SRP Object Header
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x12,
0x23, 0x10, 0x00, 0x0C, // LABEL Object Header
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x66,
0x24, 0x10, 0x00, 0x08, // FEC Object Header
0x0A, 0x0A, 0x0D, 0x0D,
0x21, 0x10, 0x00, 0x0C, // SRP Object Header
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x10,
0x20, 0x10, 0x00, 0x08, // LSP Object Header
0x00, 0x01, 0x00, 0x00,
0x23, 0x10, 0x00, 0x0C, // LABEL Object Header
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x66,
0x23, 0x10, 0x00, 0x0C, // LABEL Object Header
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x77,
0x21, 0x10, 0x00, 0x0C, // SRP Object Header
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x10,
0x20, 0x10, 0x00, 0x08, // LSP Object Header
0x00, 0x01, 0x00, 0x00,
0x23, 0x10, 0x00, 0x0C, // LABEL Object Header
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x66,
0x23, 0x10, 0x00, 0x0C, // LABEL Object Header
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x77};
ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
buffer.writeBytes(labelUpdate);
PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
PcepMessage message = null;
message = reader.readFrom(buffer);
byte[] testLabelUpdateMsg = {0};
Assert.assertTrue("PcepMessage is not instance of PcepLabelUpdate", message instanceof PcepLabelUpdateMsg);
ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
message.writeTo(buf);
int readLen = buf.writerIndex() - 0;
testLabelUpdateMsg = new byte[readLen];
buf.readBytes(testLabelUpdateMsg, 0, readLen);
Assert.assertArrayEquals("PcepLabelUpdate messages are not equal", labelUpdate, testLabelUpdateMsg);
}
}
/*
* 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.PcepNaiIpv4NodeId;
import com.google.common.testing.EqualsTester;
public class PcepNaiIpv4NodeIdTest {
private final PcepNaiIpv4NodeId tlv1 = PcepNaiIpv4NodeId.of(1);
private final PcepNaiIpv4NodeId tlv2 = PcepNaiIpv4NodeId.of(1);
private final PcepNaiIpv4NodeId tlv3 = PcepNaiIpv4NodeId.of(3);
@Test
public void basics() {
new EqualsTester()
.addEqualityGroup(tlv1, tlv2)
.addEqualityGroup(tlv3)
.testEquals();
}
}
/*
* 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.PcepNaiIpv6Adjacency;
import com.google.common.testing.EqualsTester;
public class PcepNaiIpv6AdjacencyTest {
private final byte[] localIpv6Addr1 = {(byte) 0x01010101 };
private final byte[] remoteIpv6Addr1 = {(byte) 0x02020202 };
private final byte[] localIpv6Addr2 = {(byte) 0x01010101 };
private final byte[] remoteIpv6Addr2 = {(byte) 0x02020202 };
private final byte[] localIpv6Addr3 = {(byte) 0x05050505 };
private final byte[] remoteIpv6Addr3 = {(byte) 0x06060606 };
private final PcepNaiIpv6Adjacency tlv1 = PcepNaiIpv6Adjacency.of(localIpv6Addr1, remoteIpv6Addr1);
private final PcepNaiIpv6Adjacency tlv2 = PcepNaiIpv6Adjacency.of(localIpv6Addr1, remoteIpv6Addr1);
private final PcepNaiIpv6Adjacency tlv3 = PcepNaiIpv6Adjacency.of(localIpv6Addr3, remoteIpv6Addr3);
@Test
public void basics() {
new EqualsTester().addEqualityGroup(tlv1, tlv2).addEqualityGroup(tlv3).testEquals();
}
}
\ No newline at end of file
/*
* 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.PcepNaiUnnumberedAdjacencyIpv4;
import com.google.common.testing.EqualsTester;
public class PcepNaiUnnumberedAdjacencyIpv4Test {
private final int localNodeId1 = 1;
private final int localInterfaceId1 = 1;
private final int remoteNodeId1 = 1;
private final int remoteInterfaceId1 = 1;
private final PcepNaiUnnumberedAdjacencyIpv4 tlv1 = PcepNaiUnnumberedAdjacencyIpv4.of(localNodeId1,
localInterfaceId1, remoteNodeId1, remoteInterfaceId1);
private final int localNodeId2 = 1;
private final int localInterfaceId2 = 1;
private final int remoteNodeId2 = 1;
private final int remoteInterfaceId2 = 1;
private final PcepNaiUnnumberedAdjacencyIpv4 tlv2 = PcepNaiUnnumberedAdjacencyIpv4.of(localNodeId2,
localInterfaceId2, remoteNodeId2, remoteInterfaceId2);
private final int localNodeId3 = 2;
private final int localInterfaceId3 = 2;
private final int remoteNodeId3 = 2;
private final int remoteInterfaceId3 = 2;
private final PcepNaiUnnumberedAdjacencyIpv4 tlv3 = PcepNaiUnnumberedAdjacencyIpv4.of(localNodeId3,
localInterfaceId3, remoteNodeId3, remoteInterfaceId3);
@Test
public void basics() {
new EqualsTester().addEqualityGroup(tlv1, tlv2).addEqualityGroup(tlv3).testEquals();
}
}
/*
* 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.Assert;
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.PcepReportMsg;
public class PcepReportMsgTest {
/**
* This test case checks for SRP object, LSP object(Symbolic path name tlv), ERO object
* in PcRpt message.
*
* @throws PcepParseException while parsing PCEP message
*/
@Test
public void reportMessageTest1() throws PcepParseException {
byte[] reportMsg = new byte[] {0x20, 0x0a, 0x00, 0x24,
0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, //SRP Object
0x20, 0x10, 0x00, 0x10, 0x00, 0x00, 0x10, 0x03, //LSP Object
0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv
0x07, 0x10, 0x00, 0x04 }; //ERO Object
byte[] testReportMsg = {0};
ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
buffer.writeBytes(reportMsg);
PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
PcepMessage message = null;
message = reader.readFrom(buffer);
Assert.assertTrue("PcepMessage is not instance of PcRpt", message instanceof PcepReportMsg);
ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
message.writeTo(buf);
int readLen = buf.writerIndex() - 0;
testReportMsg = new byte[readLen];
buf.readBytes(testReportMsg, 0, readLen);
Assert.assertArrayEquals("PcRpt messages are not equal", reportMsg, testReportMsg);
}
/**
* This test case checks for SRP Object, LSP Object(StatefulIPv4LspIdentidiersTlv,SymbolicPathNameTlv
* StatefulLspErrorCodeTlv) ERO Object, LSPA Object, Metric-list, IRO object
* in PcRpt message.
*
* @throws PcepParseException while parsing PCEP message
*/
@Test
public void reportMessageTest2() throws PcepParseException {
byte[] reportMsg = new byte[] {0x20, 0x0a, 0x00, (byte) 0x7c,
0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, //SRP Object
0x20, 0x10, 0x00, 0x2c, 0x00, 0x00, 0x10, 0x03, //LSP Object // LSP Object
0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv
(byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01,
(byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20,
0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv
0x00, 0x14, 0x00, 0x04, 0x00, 0x00, 0x00, 0x08, //StatefulLspErrorCodeTlv
0x07, 0x10, 0x00, 0x14, //ERO Object
0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x04, 0x00, // IPv4SubObjects
0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x20, 0x04, 0x00,
0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //LSPA Object
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x02, 0x02, 0x00, 0x00, 0x00, 0x00, //Metric Object
0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20, //Metric Object
};
byte[] testReportMsg = {0};
ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
buffer.writeBytes(reportMsg);
PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
PcepMessage message = null;
message = reader.readFrom(buffer);
Assert.assertTrue("PcepMessage is not instance of PcRpt", message instanceof PcepReportMsg);
ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
message.writeTo(buf);
int readLen = buf.writerIndex() - 0;
testReportMsg = new byte[readLen];
buf.readBytes(testReportMsg, 0, readLen);
Assert.assertArrayEquals("PcRpt messages are not equal", reportMsg, testReportMsg);
}
/**
* This test case checks for LSP Object(StatefulIPv4LspIdentidiersTlv,SymbolicPathNameTlv,StatefulLspErrorCodeTlv)
* ERO Object, LSPA Object, Metric-list, IRO object
* in PcRpt message.
*
* @throws PcepParseException while parsing PCEP message
*/
@Test
public void reportMessageTest3() throws PcepParseException {
byte[] reportMsg = new byte[] {0x20, 0x0a, 0x00, (byte) 0x70,
0x20, 0x10, 0x00, 0x2c, 0x00, 0x00, 0x10, 0x03, //LSP Object //LSP Object
0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv
(byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01,
(byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20,
0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv
0x00, 0x14, 0x00, 0x04, 0x00, 0x00, 0x00, 0x08, //StatefulLspErrorCodeTlv
0x07, 0x10, 0x00, 0x14, //ERO Object
0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x04, 0x00, //Ipv4SubObjects
0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x20, 0x04, 0x00,
0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //LSPA Object
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x02, 0x02, 0x00, 0x00, 0x00, 0x00, //Metric Objects
0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20, //Metric Object
};
byte[] testReportMsg = {0};
ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
buffer.writeBytes(reportMsg);
PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
PcepMessage message = null;
message = reader.readFrom(buffer);
Assert.assertTrue("PcepMessage is not instance of PcRpt", message instanceof PcepReportMsg);
ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
message.writeTo(buf);
int readLen = buf.writerIndex() - 0;
testReportMsg = new byte[readLen];
buf.readBytes(testReportMsg, 0, readLen);
Assert.assertArrayEquals("PcRpt messages are not equal", reportMsg, testReportMsg);
}
/**
* This test case checks for LSP Object(StatefulIPv4LspIdentidiersTlv,SymbolicPathNameTlv,StatefulLspErrorCodeTlv)
* ERO Object, LSPA Object, Metric-list
* in PcRpt message.
*
* @throws PcepParseException while parsing PCEP message
*/
@Test
public void reportMessageTest4() throws PcepParseException {
byte[] reportMsg = new byte[] {0x20, 0x0a, 0x00, (byte) 0x64,
0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, //SRP Object
0x20, 0x10, 0x00, 0x2c, 0x00, 0x00, 0x10, 0x03, //LSP Object //LSP Object
0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv
(byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01,
(byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20,
0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv
0x00, 0x14, 0x00, 0x04, 0x00, 0x00, 0x00, 0x08, //StatefulLspErrorCodeTlv
0x07, 0x10, 0x00, 0x14, //ERO Object
0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x04, 0x00,
0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x20, 0x04, 0x00,
0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //LSPA Object
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
byte[] testReportMsg = {0};
ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
buffer.writeBytes(reportMsg);
PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
PcepMessage message = null;
message = reader.readFrom(buffer);
Assert.assertTrue("PcepMessage is not instance of PcRpt", message instanceof PcepReportMsg);
ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
message.writeTo(buf);
int readLen = buf.writerIndex() - 0;
testReportMsg = new byte[readLen];
buf.readBytes(testReportMsg, 0, readLen);
Assert.assertArrayEquals("PcRpt messages are not equal", reportMsg, testReportMsg);
}
/**
* This test case checks for SRP Object, LSP Object(StatefulIPv4LspIdentidiersTlv,SymbolicPathNameTlv
* StatefulLspErrorCodeTlv) ERO Object, IRO object
* in PcRpt message.
*
* @throws PcepParseException while parsing PCEP message
*/
@Test
public void reportMessageTest5() throws PcepParseException {
byte[] reportMsg = new byte[] {0x20, 0x0a, 0x00, (byte) 0x50,
0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, //SRP Object
0x20, 0x10, 0x00, 0x2c, 0x00, 0x00, 0x10, 0x03, //LSP Object //LSP Object
0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv
(byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01,
(byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20,
0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv
0x00, 0x14, 0x00, 0x04, 0x00, 0x00, 0x00, 0x08, //StatefulLspErrorCodeTlv
0x07, 0x10, 0x00, 0x14, //ERO Object
0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x04, 0x00,
0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x20, 0x04, 0x00 };
byte[] testReportMsg = {0};
ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
buffer.writeBytes(reportMsg);
PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
PcepMessage message = null;
message = reader.readFrom(buffer);
Assert.assertTrue("PcepMessage is not instance of PcRpt", message instanceof PcepReportMsg);
ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
message.writeTo(buf);
int readLen = buf.writerIndex() - 0;
testReportMsg = new byte[readLen];
buf.readBytes(testReportMsg, 0, readLen);
Assert.assertArrayEquals("PcRpt messages are not equal", reportMsg, testReportMsg);
}
/**
* This test case checks for SRP Object, LSP Object(StatefulIPv4LspIdentidiersTlv,SymbolicPathNameTlv
* StatefulLspErrorCodeTlv) ERO Object, LSPA Object, Metric-list.
* in PcRpt message.
*
* @throws PcepParseException while parsing PCEP message
*/
@Test
public void reportMessageTest6() throws PcepParseException {
byte[] reportMsg = new byte[] {0x20, 0x0a, 0x00, (byte) 0x6c,
0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, //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, 0x04, //ERO Object
0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //LSPA Object
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x02, 0x02, 0x00, 0x00, 0x00, 0x00, //Metric object
0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20, //Metric Object
};
byte[] testReportMsg = {0};
ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
buffer.writeBytes(reportMsg);
PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
PcepMessage message = null;
message = reader.readFrom(buffer);
Assert.assertTrue("PcepMessage is not instance of PcRpt", message instanceof PcepReportMsg);
ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
message.writeTo(buf);
int readLen = buf.writerIndex() - 0;
testReportMsg = new byte[readLen];
buf.readBytes(testReportMsg, 0, readLen);
Assert.assertArrayEquals("PcRpt messages are not equal", reportMsg, testReportMsg);
}
/**
* This test case checks for LSP Object, ERO Object, LSPA Object, Metric-list, IRO object
* in PcRpt message.
*
* @throws PcepParseException while parsing PCEP message
*/
@Test
public void reportMessageTest7() throws PcepParseException {
byte[] reportMsg = new byte[] {0x20, 0x0a, 0x00, (byte) 0x58,
0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, //SRP Object
0x20, 0x10, 0x00, 0x08, 0x00, 0x00, 0x10, 0x03, //LSP Object
0x07, 0x10, 0x00, 0x14, //ERO Object
0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x04, 0x00,
0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x20, 0x04, 0x00,
0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA Object
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x02, 0x02, 0x00, 0x00, 0x00, 0x00, // Metric objects
0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20 };
byte[] testReportMsg = {0};
ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
buffer.writeBytes(reportMsg);
PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
PcepMessage message = null;
message = reader.readFrom(buffer);
Assert.assertTrue("PcepMessage is not instance of PcRpt", message instanceof PcepReportMsg);
ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
message.writeTo(buf);
int readLen = buf.writerIndex() - 0;
testReportMsg = new byte[readLen];
buf.readBytes(testReportMsg, 0, readLen);
Assert.assertArrayEquals("PcRpt messages are not equal", reportMsg, testReportMsg);
}
/**
* This test case checks for SRP object, LSP object( StatefulIPv4LspIdentidiersTlv, SymbolicPathNameTlv,
* StatefulLspErrorCodeTlv) ERO object, LSPA object, Metric object
* in PcRpt message.
*
* @throws PcepParseException while parsing PCEP message
*/
@Test
public void reportMessageTest8() throws PcepParseException {
byte[] reportMsg = new byte[] {0x20, 0x0a, 0x00, (byte) 0x70,
0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, //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, //ERO Object
0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x04, 0x00,
0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x20, 0x04, 0x00,
0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //LSPA Object
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20}; //Metric Object
byte[] testReportMsg = {0};
ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
buffer.writeBytes(reportMsg);
PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
PcepMessage message = null;
message = reader.readFrom(buffer);
Assert.assertTrue("PcepMessage is not instance of PcRpt", message instanceof PcepReportMsg);
ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
message.writeTo(buf);
int readLen = buf.writerIndex() - 0;
testReportMsg = new byte[readLen];
buf.readBytes(testReportMsg, 0, readLen);
Assert.assertArrayEquals("PcRpt messages are not equal", reportMsg, testReportMsg);
}
/**
* This test case checks for LSP Object(Symbolic path tlv, StatefulIPv4LspIdentidiersTlv,
* StatefulLspErrorCodeTlv ),ERO Object
* in PcRpt message.
*
* @throws PcepParseException while parsing PCEP message
*/
@Test
public void reportMessageTest9() throws PcepParseException {
byte[] reportMsg = new byte[] {0x20, 0x0a, 0x00, (byte) 0x44,
0x20, 0x10, 0x00, 0x2c, 0x00, 0x00, 0x10, 0x03, //LSP Object //LSP Object
0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv
(byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01,
(byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20,
0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv
0x00, 0x14, 0x00, 0x04, 0x00, 0x00, 0x00, 0x08, //StatefulLspErrorCodeTlv
0x07, 0x10, 0x00, 0x14, //ERO Object
0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x04, 0x00,
0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x20, 0x04, 0x00 };
byte[] testReportMsg = {0};
ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
buffer.writeBytes(reportMsg);
PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
PcepMessage message = null;
message = reader.readFrom(buffer);
Assert.assertTrue("PcepMessage is not instance of PcRpt", message instanceof PcepReportMsg);
ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
message.writeTo(buf);
int readLen = buf.writerIndex() - 0;
testReportMsg = new byte[readLen];
buf.readBytes(testReportMsg, 0, readLen);
Assert.assertArrayEquals("PcRpt messages are not equal", reportMsg, testReportMsg);
}
/**
* This test case checks for SRP Object,LSP Object(StatefulIPv4LspIdentidiersTlv)ERO Object,RRO Object
* in PcRpt message.
*
* @throws PcepParseException while parsing PCEP message
*/
@Test
public void reportMessageTest10() throws PcepParseException {
byte[] reportMsg = new byte[] {0x20, 0x0a, 0x00, (byte) 0x74,
0x21, 0x10, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, //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, //ERO Object
0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x04, 0x00,
0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x20, 0x04, 0x00,
0x08, 0x10, 0x00, 0x34, 0x01, 0x08, 0x11, 0x01, //RRO Object
0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01,
0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x06, 0x06,
0x06, 0x06, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01,
0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01,
0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x05, 0x05, 0x05, 0x05, 0x04, 0x00 };
byte[] testReportMsg = {0};
ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
buffer.writeBytes(reportMsg);
PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
PcepMessage message = null;
message = reader.readFrom(buffer);
Assert.assertTrue("PcepMessage is not instance of PcRpt", message instanceof PcepReportMsg);
ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
message.writeTo(buf);
int readLen = buf.writerIndex() - 0;
testReportMsg = new byte[readLen];
buf.readBytes(testReportMsg, 0, readLen);
Assert.assertArrayEquals("PcRpt messages are not equal", reportMsg, testReportMsg);
}
/**
* This test case checks for SRP Object,LSP Object(SymbolicPathNameTlv)ERO Object,RRO Object
* in PcRpt message.
*
* @throws PcepParseException while parsing PCEP message
*/
@Test
public void reportMessageTest11() throws PcepParseException {
byte[] reportMsg = new byte[] {0x20, 0x0a, 0x00, (byte) 0x68,
0x21, 0x10, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, //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, //ERO Object
0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x04, 0x00,
0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x20, 0x04, 0x00,
0x08, 0x10, 0x00, 0x34, 0x01, 0x08, 0x11, 0x01, //RRO Object
0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01,
0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x06, 0x06,
0x06, 0x06, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01,
0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01,
0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x05, 0x05, 0x05, 0x05, 0x04, 0x00 };
byte[] testReportMsg = {0};
ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
buffer.writeBytes(reportMsg);
PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
PcepMessage message = null;
message = reader.readFrom(buffer);
Assert.assertTrue("PcepMessage is not instance of PcRpt", message instanceof PcepReportMsg);
ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
message.writeTo(buf);
int readLen = buf.writerIndex() - 0;
testReportMsg = new byte[readLen];
buf.readBytes(testReportMsg, 0, readLen);
Assert.assertArrayEquals("PcRpt messages are not equal", reportMsg, testReportMsg);
}
/**
* This test case checks for SRP Object,LSP Object, ERO Object,RRO Object
* in PcRpt message.
*
* @throws PcepParseException while parsing PCEP message
*/
@Test
public void reportMessageTest12() throws PcepParseException {
byte[] reportMsg = new byte[] {0x20, 0x0a, 0x00, (byte) 0x60,
0x21, 0x10, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, //SRP Object
0x20, 0x10, 0x00, 0x08, 0x00, 0x00, 0x10, 0x03, //LSP Object
0x07, 0x10, 0x00, 0x14, //ERO Object
0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x04, 0x00,
0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x04, 0x00,
0x08, 0x10, 0x00, 0x34, 0x01, 0x08, 0x11, 0x01, //RRO Object
0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01,
0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x06, 0x06,
0x06, 0x06, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01,
0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01,
0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x05, 0x05, 0x05, 0x05, 0x04, 0x00 };
byte[] testReportMsg = {0};
ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
buffer.writeBytes(reportMsg);
PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
PcepMessage message = null;
message = reader.readFrom(buffer);
Assert.assertTrue("PcepMessage is not instance of PcRpt", message instanceof PcepReportMsg);
ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
message.writeTo(buf);
int readLen = buf.writerIndex() - 0;
testReportMsg = new byte[readLen];
buf.readBytes(testReportMsg, 0, readLen);
Assert.assertArrayEquals("PcRpt messages are not equal", reportMsg, testReportMsg);
}
/**
* This test case checks for SRP Object,LSP Object(StatefulLspErrorCodeTlv)ERO Object,RRO Object
* in PcRpt message.
*
* @throws PcepParseException while parsing PCEP message
*/
@Test
public void reportMessageTest13() throws PcepParseException {
byte[] reportMsg = new byte[] {0x20, 0x0a, 0x00, (byte) 0x68,
0x21, 0x10, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, //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, //ERO Object
0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x04, 0x00,
0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x20, 0x04, 0x00,
0x08, 0x10, 0x00, 0x34, 0x01, 0x08, 0x11, 0x01, //RRO Object
0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01,
0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x06, 0x06,
0x06, 0x06, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01,
0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01,
0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x05, 0x05, 0x05, 0x05, 0x04, 0x00 };
byte[] testReportMsg = {0};
ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
buffer.writeBytes(reportMsg);
PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
PcepMessage message = null;
message = reader.readFrom(buffer);
Assert.assertTrue("PcepMessage is not instance of PcRpt", message instanceof PcepReportMsg);
ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
message.writeTo(buf);
int readLen = buf.writerIndex() - 0;
testReportMsg = new byte[readLen];
buf.readBytes(testReportMsg, 0, readLen);
Assert.assertArrayEquals("PcRpt messages are not equal", reportMsg, testReportMsg);
}
/**
* This test case checks for SRP Object,LSP Object(StatefulRsvpErrorSpecTlv),ERO Object,RRO Object
* in PcRpt message.
*
* @throws PcepParseException while parsing PCEP message
*/
@Test
public void reportMessageTest14() throws PcepParseException {
byte[] reportMsg = new byte[] {0x20, 0x0a, 0x00, (byte) 0x60,
0x21, 0x10, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, //SRP Object
0x20, 0x10, 0x00, 0x08, 0x00, 0x00, 0x10, 0x03, //LSP Object
0x07, 0x10, 0x00, 0x14, //ERO Object
0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x04, 0x00,
0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x20, 0x04, 0x00,
0x08, 0x10, 0x00, 0x34, 0x01, 0x08, 0x11, 0x01, //RRO Object
0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01,
0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x06, 0x06,
0x06, 0x06, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01,
0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01,
0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x05, 0x05, 0x05, 0x05, 0x04, 0x00 };
byte[] testReportMsg = {0};
ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
buffer.writeBytes(reportMsg);
PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
PcepMessage message = null;
message = reader.readFrom(buffer);
Assert.assertTrue("PcepMessage is not instance of PcRpt", message instanceof PcepReportMsg);
ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
message.writeTo(buf);
int readLen = buf.writerIndex() - 0;
testReportMsg = new byte[readLen];
buf.readBytes(testReportMsg, 0, readLen);
Assert.assertArrayEquals("PcRpt messages are not equal", reportMsg, testReportMsg);
}
/**
* This test case checks for SRP Object,LSP Object(symbolic path tlv),LSPA Object,ERO Object
* in PcRpt message.
*
* @throws PcepParseException while parsing PCEP message
*/
@Test
public void reportMessageTest15() throws PcepParseException {
byte[] reportMsg = new byte[] {0x20, 0x0a, 0x00, (byte) 0x7C,
0x21, 0x10, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, //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, //ERO Object
0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x04, 0x00,
0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x20, 0x04, 0x00,
0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA Object
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x08, 0x10, 0x00, 0x34, 0x01, 0x08, 0x11, 0x01, //RRO Object
0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01,
0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x06, 0x06,
0x06, 0x06, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01,
0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01,
0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x05, 0x05, 0x05, 0x05, 0x04, 0x00 };
byte[] testReportMsg = {0};
ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
buffer.writeBytes(reportMsg);
PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
PcepMessage message = null;
message = reader.readFrom(buffer);
Assert.assertTrue("PcepMessage is not instance of PcRpt", message instanceof PcepReportMsg);
ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
message.writeTo(buf);
int readLen = buf.writerIndex() - 0;
testReportMsg = new byte[readLen];
buf.readBytes(testReportMsg, 0, readLen);
Assert.assertArrayEquals("PcRpt messages are not equal", reportMsg, testReportMsg);
}
/**
* This test case checks for SRP Object,LSP Object(symbolic path tlv),BandWidth Object,ERO Object
* in PcRpt message.
*
* @throws PcepParseException while parsing PCEP message
*/
@Test
public void reportMessageTest16() throws PcepParseException {
byte[] reportMsg = new byte[] {0x20, 0x0a, 0x00, (byte) 0x70,
0x21, 0x10, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, //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, //ERO Object
0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x04, 0x00,
0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x20, 0x04, 0x00,
0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, //Bandwidth Object
0x08, 0x10, 0x00, 0x34, 0x01, 0x08, 0x11, 0x01, //RRO Object
0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01,
0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x06, 0x06,
0x06, 0x06, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01,
0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01,
0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x05, 0x05, 0x05, 0x05, 0x04, 0x00 };
byte[] testReportMsg = {0};
ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
buffer.writeBytes(reportMsg);
PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
PcepMessage message = null;
message = reader.readFrom(buffer);
Assert.assertTrue("PcepMessage is not instance of PcRpt", message instanceof PcepReportMsg);
ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
message.writeTo(buf);
int readLen = buf.writerIndex() - 0;
testReportMsg = new byte[readLen];
buf.readBytes(testReportMsg, 0, readLen);
Assert.assertArrayEquals("PcRpt messages are not equal", reportMsg, testReportMsg);
}
/**
* This test case checks for SRP Object,LSP Object,ERO Object,LSPA Object,RRO Object
* in PcRpt message.
*
* @throws PcepParseException while parsing PCEP message
*/
@Test
public void reportMessageTest17() throws PcepParseException {
byte[] reportMsg = new byte[] {0x20, 0x0a, 0x00, (byte) 0x74,
0x21, 0x10, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, //SRP Object
0x20, 0x10, 0x00, 0x08, 0x00, 0x00, 0x10, 0x03, //LSP Object
0x07, 0x10, 0x00, 0x14, //ERO Object
0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x04, 0x00,
0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x20, 0x04, 0x00,
0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA Object
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x08, 0x10, 0x00, 0x34, 0x01, 0x08, 0x11, 0x01, //RRO Object
0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01,
0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x06, 0x06,
0x06, 0x06, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01,
0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01,
0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x05, 0x05, 0x05, 0x05, 0x04, 0x00 };
byte[] testReportMsg = {0};
ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
buffer.writeBytes(reportMsg);
PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
PcepMessage message = null;
message = reader.readFrom(buffer);
Assert.assertTrue("PcepMessage is not instance of PcRpt", message instanceof PcepReportMsg);
ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
message.writeTo(buf);
int readLen = buf.writerIndex() - 0;
testReportMsg = new byte[readLen];
buf.readBytes(testReportMsg, 0, readLen);
Assert.assertArrayEquals("PcRpt messages are not equal", reportMsg, testReportMsg);
}
/**
* This test case checks for SRP Object,LSP Object,ERO Object,BandWidth Object,RRO Object
* in PcRpt message.
*
* @throws PcepParseException while parsing PCEP message
*/
@Test
public void reportMessageTest18() throws PcepParseException {
byte[] reportMsg = new byte[] {0x20, 0x0a, 0x00, (byte) 0x68,
0x21, 0x10, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, //SRP Object
0x20, 0x10, 0x00, 0x08, 0x00, 0x00, 0x10, 0x03, //LSP Object
0x07, 0x10, 0x00, 0x14, //ERO Object
0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x04, 0x00,
0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x20, 0x04, 0x00,
0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, //Bandwidth Object
0x08, 0x10, 0x00, 0x34, 0x01, 0x08, 0x11, 0x01, //RRO Object
0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01,
0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x06, 0x06,
0x06, 0x06, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01,
0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01,
0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x05, 0x05, 0x05, 0x05, 0x04, 0x00 };
byte[] testReportMsg = {0};
ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
buffer.writeBytes(reportMsg);
PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
PcepMessage message = null;
message = reader.readFrom(buffer);
Assert.assertTrue("PcepMessage is not instance of PcRpt", message instanceof PcepReportMsg);
ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
message.writeTo(buf);
int readLen = buf.writerIndex() - 0;
testReportMsg = new byte[readLen];
buf.readBytes(testReportMsg, 0, readLen);
Assert.assertArrayEquals("PcRpt messages are not equal", reportMsg, testReportMsg);
}
/**
* This test case checks for SRP Object,LSP Object,ERO Object,Metric-list,RRO Object
* in PcRpt message.
*
* @throws PcepParseException while parsing PCEP message
*/
@Test
public void reportMessageTest19() throws PcepParseException {
byte[] reportMsg = new byte[] {0x20, 0x0a, 0x00, (byte) 0x6C,
0x21, 0x10, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, //SRP Object
0x20, 0x10, 0x00, 0x08, 0x00, 0x00, 0x10, 0x03, //LSP Object
0x07, 0x10, 0x00, 0x14, //ERO Object
0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x04, 0x00,
0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x20, 0x04, 0x00,
0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20, //Metric Object
0x08, 0x10, 0x00, 0x34, 0x01, 0x08, 0x11, 0x01, //RRO Object
0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01,
0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x06, 0x06,
0x06, 0x06, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01,
0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01,
0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x05, 0x05, 0x05, 0x05, 0x04, 0x00 };
byte[] testReportMsg = {0};
ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
buffer.writeBytes(reportMsg);
PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
PcepMessage message = null;
message = reader.readFrom(buffer);
Assert.assertTrue("PcepMessage is not instance of PcRpt", message instanceof PcepReportMsg);
ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
message.writeTo(buf);
int readLen = buf.writerIndex() - 0;
testReportMsg = new byte[readLen];
buf.readBytes(testReportMsg, 0, readLen);
Assert.assertArrayEquals("PcRpt messages are not equal", reportMsg, testReportMsg);
}
/**
* This test case checks for SRP Object,LSP Object,ERO Object,LSPA Object,BandWidth Object,Metric-list,RRO Object
* in PcRpt message.
*
* @throws PcepParseException while parsing PCEP message
*/
@Test
public void reportMessageTest20() throws PcepParseException {
byte[] reportMsg = new byte[] {0x20, 0x0a, 0x00, (byte) 0x88,
0x21, 0x10, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, //SRP Object
0x20, 0x10, 0x00, 0x08, 0x00, 0x00, 0x10, 0x03, //LSP Object
0x07, 0x10, 0x00, 0x14, //ERO Object
0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x04, 0x00,
0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x20, 0x04, 0x00,
0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, //Bandwidth Object
0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20, //Metric Object
0x08, 0x10, 0x00, 0x34, 0x01, 0x08, 0x11, 0x01, //RRO Object
0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01,
0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x06, 0x06,
0x06, 0x06, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01,
0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01,
0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x05, 0x05, 0x05, 0x05, 0x04, 0x00 };
byte[] testReportMsg = {0};
ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
buffer.writeBytes(reportMsg);
PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
PcepMessage message = null;
message = reader.readFrom(buffer);
Assert.assertTrue("PcepMessage is not instance of PcRpt", message instanceof PcepReportMsg);
ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
message.writeTo(buf);
int readLen = buf.writerIndex() - 0;
testReportMsg = new byte[readLen];
buf.readBytes(testReportMsg, 0, readLen);
Assert.assertArrayEquals("PcRpt messages are not equal", reportMsg, testReportMsg);
}
/**
* This test case checks for SRP Object,LSP Object(Symbolic path tlv, StatefulIPv4LspIdentidiersTlv,
* StatefulLspErrorCodeTlv ) ERO Object,LSPA Object,BandWidth Object,Metric-list,RRO Object
* in PcRpt message.
* @throws PcepParseException while parsing PCEP message
*/
@Test
public void reportMessageTest21() throws PcepParseException {
byte[] reportMsg = new byte[] {0x20, 0x0a, 0x00, (byte) 0xac,
0x21, 0x10, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, //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, //ERO Object
0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x04, 0x00,
0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x20, 0x04, 0x00,
0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, //Bandwidth Object
0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20, //Metric Object
0x08, 0x10, 0x00, 0x34, 0x01, 0x08, 0x11, 0x01, //RRO Object
0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01,
0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x06, 0x06,
0x06, 0x06, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01,
0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01,
0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x05, 0x05, 0x05, 0x05, 0x04, 0x00 };
byte[] testReportMsg = {0};
ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
buffer.writeBytes(reportMsg);
PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
PcepMessage message = null;
message = reader.readFrom(buffer);
Assert.assertTrue("PcepMessage is not instance of PcRpt", message instanceof PcepReportMsg);
ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
message.writeTo(buf);
int readLen = buf.writerIndex() - 0;
testReportMsg = new byte[readLen];
buf.readBytes(testReportMsg, 0, readLen);
Assert.assertArrayEquals("PcRpt messages are not equal", reportMsg, testReportMsg);
}
/**
* This test case checks for LSP Object(Symbolic path tlv, StatefulIPv4LspIdentidiersTlv,StatefulLspErrorCodeTlv )
* ERO Object,LSPA Object,BandWidth Object,Metric-list,RRO Object
* in PcRpt message.
*
* @throws PcepParseException while parsing PCEP message
*/
@Test
public void reportMessageTest22() throws PcepParseException {
byte[] reportMsg = new byte[] {0x20, 0x0a, 0x00, (byte) 0xA0,
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, //ERO Object
0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x04, 0x00,
0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x20, 0x04, 0x00,
0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, //Bandwidth Object
0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20, //Metric Object
0x08, 0x10, 0x00, 0x34, 0x01, 0x08, 0x11, 0x01, //RRO Object
0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01,
0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x06, 0x06,
0x06, 0x06, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01,
0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01,
0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x05, 0x05, 0x05, 0x05, 0x04, 0x00 };
byte[] testReportMsg = {0};
ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
buffer.writeBytes(reportMsg);
PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
PcepMessage message = null;
message = reader.readFrom(buffer);
Assert.assertTrue("PcepMessage is not instance of PcRpt", message instanceof PcepReportMsg);
ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
message.writeTo(buf);
int readLen = buf.writerIndex() - 0;
testReportMsg = new byte[readLen];
buf.readBytes(testReportMsg, 0, readLen);
Assert.assertArrayEquals("PcRpt messages are not equal", reportMsg, testReportMsg);
}
/**
* This test case checks for LSP Object(Symbolic path tlv, StatefulIPv4LspIdentidiersTlv,StatefulLspErrorCodeTlv )
* ERO Object,BandWidth Object,Metric-list,RRO Object
* in PcRpt message.
*
* @throws PcepParseException while parsing PCEP message
*/
@Test
public void reportMessageTest23() throws PcepParseException {
byte[] reportMsg = new byte[] {0x20, 0x0a, 0x00, (byte) 0x8c,
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, //ERO Object
0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x04, 0x00,
0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x20, 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
0x08, 0x10, 0x00, 0x34, 0x01, 0x08, 0x11, 0x01, //RRO Object
0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01,
0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x06, 0x06,
0x06, 0x06, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01,
0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01,
0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x05, 0x05, 0x05, 0x05, 0x04, 0x00 };
byte[] testReportMsg = {0};
ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
buffer.writeBytes(reportMsg);
PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
PcepMessage message = null;
message = reader.readFrom(buffer);
Assert.assertTrue("PcepMessage is not instance of PcRpt", message instanceof PcepReportMsg);
ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
message.writeTo(buf);
int readLen = buf.writerIndex() - 0;
testReportMsg = new byte[readLen];
buf.readBytes(testReportMsg, 0, readLen);
Assert.assertArrayEquals("PcRpt messages are not equal", reportMsg, testReportMsg);
}
/**
* This test case checks for LSP Object(Symbolic path tlv, StatefulIPv4LspIdentidiersTlv,StatefulLspErrorCodeTlv )
* ERO Object,Metric-list,RRO Object
* in PcRpt message.
*
* @throws PcepParseException while parsing PCEP message
*/
@Test
public void reportMessageTest24() throws PcepParseException {
byte[] reportMsg = new byte[] {0x20, 0x0a, 0x00, (byte) 0x84,
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, //ERO Object
0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x04, 0x00,
0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x20, 0x04, 0x00,
0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20, //Metric Object
0x08, 0x10, 0x00, 0x34, 0x01, 0x08, 0x11, 0x01, //RRO Object
0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01,
0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x06, 0x06,
0x06, 0x06, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01,
0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01,
0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x05, 0x05, 0x05, 0x05, 0x04, 0x00 };
byte[] testReportMsg = {0};
ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
buffer.writeBytes(reportMsg);
PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
PcepMessage message = null;
message = reader.readFrom(buffer);
Assert.assertTrue("PcepMessage is not instance of PcRpt", message instanceof PcepReportMsg);
ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
message.writeTo(buf);
int readLen = buf.writerIndex() - 0;
testReportMsg = new byte[readLen];
buf.readBytes(testReportMsg, 0, readLen);
Assert.assertArrayEquals("PcRpt messages are not equal", reportMsg, testReportMsg);
}
/**
* This test case checks for LSP Object(Symbolic path tlv, StatefulIPv4LspIdentidiersTlv,StatefulLspErrorCodeTlv )
* ERO Object,LSPA Object,RRO Object
* in PcRpt message.
*
* @throws PcepParseException while parsing PCEP message
*/
@Test
public void reportMessageTest25() throws PcepParseException {
byte[] reportMsg = new byte[] {0x20, 0x0a, 0x00, (byte) 0x8c,
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, //ERO Object
0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x04, 0x00,
0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x20, 0x04, 0x00,
0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, //LSPA Object
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x08, 0x10, 0x00, 0x34, 0x01, 0x08, 0x11, 0x01, //RRO Object
0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01,
0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x06, 0x06,
0x06, 0x06, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01,
0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01,
0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x05, 0x05, 0x05, 0x05, 0x04, 0x00 };
byte[] testReportMsg = {0};
ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
buffer.writeBytes(reportMsg);
PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
PcepMessage message = null;
message = reader.readFrom(buffer);
Assert.assertTrue("PcepMessage is not instance of PcRpt", message instanceof PcepReportMsg);
ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
message.writeTo(buf);
int readLen = buf.writerIndex() - 0;
testReportMsg = new byte[readLen];
buf.readBytes(testReportMsg, 0, readLen);
Assert.assertArrayEquals("PcRpt messages are not equal", reportMsg, testReportMsg);
}
/**
* This test case checks for LSP Object(Symbolic path tlv, StatefulIPv4LspIdentidiersTlv,StatefulLspErrorCodeTlv )
* ERO Object,LSPA Object
* in PcRpt message.
*
* @throws PcepParseException while parsing PCEP message
*/
@Test
public void reportMessageTest26() throws PcepParseException {
byte[] reportMsg = new byte[] {0x20, 0x0a, 0x00, (byte) 0x58,
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, //ERO Object
0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x04, 0x00,
0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x20, 0x04, 0x00,
0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, //LSPA Object
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
byte[] testReportMsg = {0};
ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
buffer.writeBytes(reportMsg);
PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
PcepMessage message = null;
message = reader.readFrom(buffer);
Assert.assertTrue("PcepMessage is not instance of PcRpt", message instanceof PcepReportMsg);
ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
message.writeTo(buf);
int readLen = buf.writerIndex() - 0;
testReportMsg = new byte[readLen];
buf.readBytes(testReportMsg, 0, readLen);
Assert.assertArrayEquals("PcRpt messages are not equal", reportMsg, testReportMsg);
}
/**
* This test case checks for LSP Object(Symbolic path tlv, StatefulIPv4LspIdentidiersTlv,StatefulLspErrorCodeTlv)
* ERO Object
* in PcRpt message.
*
* @throws PcepParseException while parsing PCEP message
*/
@Test
public void reportMessageTest27() throws PcepParseException {
byte[] reportMsg = new byte[] {0x20, 0x0a, 0x00, (byte) 0x44,
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, //ERO Object
0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x04, 0x00,
0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x20, 0x04, 0x00 };
byte[] testReportMsg = {0};
ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
buffer.writeBytes(reportMsg);
PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
PcepMessage message = null;
message = reader.readFrom(buffer);
Assert.assertTrue("PcepMessage is not instance of PcRpt", message instanceof PcepReportMsg);
ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
message.writeTo(buf);
int readLen = buf.writerIndex() - 0;
testReportMsg = new byte[readLen];
buf.readBytes(testReportMsg, 0, readLen);
Assert.assertArrayEquals("PcRpt messages are not equal", reportMsg, testReportMsg);
}
/**
* This test case checks for LSP Object(Symbolic path tlv, StatefulIPv4LspIdentidiersTlv,StatefulLspErrorCodeTlv )
* LSPA Object,BandWidth Object,Metric-list,ERO Object
* in PcRpt message.
*
* @throws PcepParseException while parsing PCEP message
*/
@Test
public void reportMessageTest28() throws PcepParseException {
byte[] reportMsg = new byte[] {0x20, 0x0a, 0x00, (byte) 0x6c,
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, //ERO Object
0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x04, 0x00,
0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x20, 0x04, 0x00,
0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, //Bandwidth Object
0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20 };
byte[] testReportMsg = {0};
ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
buffer.writeBytes(reportMsg);
PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
PcepMessage message = null;
message = reader.readFrom(buffer);
Assert.assertTrue("PcepMessage is not instance of PcRpt", message instanceof PcepReportMsg);
ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
message.writeTo(buf);
int readLen = buf.writerIndex() - 0;
testReportMsg = new byte[readLen];
buf.readBytes(testReportMsg, 0, readLen);
Assert.assertArrayEquals("PcRpt messages are not equal", reportMsg, testReportMsg);
}
/**
* This test case checks for SRP Object,LSP Object(symbolic path tlv),ERO Object,Metric-list,RRO Object
* in PcRpt message.
*
* @throws PcepParseException while parsing PCEP message
*/
@Test
public void reportMessageTest29() throws PcepParseException {
byte[] reportMsg = new byte[] {0x20, 0x0a, 0x00, (byte) 0x74,
0x21, 0x10, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, //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, //ERO Object
0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x04, 0x00,
0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x20, 0x04, 0x00,
0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20, //Metric Object
0x08, 0x10, 0x00, 0x34, 0x01, 0x08, 0x11, 0x01, //RRO Object
0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01,
0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x06, 0x06,
0x06, 0x06, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01,
0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01,
0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x05, 0x05, 0x05, 0x05, 0x04, 0x00 };
byte[] testReportMsg = {0};
ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
buffer.writeBytes(reportMsg);
PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
PcepMessage message = null;
message = reader.readFrom(buffer);
Assert.assertTrue("PcepMessage is not instance of PcRpt", message instanceof PcepReportMsg);
ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
message.writeTo(buf);
int readLen = buf.writerIndex() - 0;
testReportMsg = new byte[readLen];
buf.readBytes(testReportMsg, 0, readLen);
Assert.assertArrayEquals("PcRpt messages are not equal", reportMsg, testReportMsg);
}
/**
* This test case checks for SRP Object,LSP Object(symbolic path tlv),ERO Object,Metric-list,RRO Object
* SRP Object,LSP Object(symbolic path tlv),ERO Object,Metric-list,RRO Object
* in PcRpt message.
*
* @throws PcepParseException while parsing PCEP message
*/
@Test
public void reportMessageTest30() throws PcepParseException {
byte[] reportMsg = new byte[] {0x20, 0x0a, 0x00, (byte) 0xE4,
0x21, 0x10, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, //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, //ERO Object
0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x04, 0x00,
0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x20, 0x04, 0x00,
0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20, //Metric Object
0x08, 0x10, 0x00, 0x34, 0x01, 0x08, 0x11, 0x01, //RRO Object
0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01,
0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x06, 0x06,
0x06, 0x06, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01,
0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01,
0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x05, 0x05, 0x05, 0x05, 0x04, 0x00,
0x21, 0x10, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, //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, //ERO Object
0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x04, 0x00,
0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x20, 0x04, 0x00,
0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20, //Metric Object
0x08, 0x10, 0x00, 0x34, 0x01, 0x08, 0x11, 0x01, //RRO Object
0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01,
0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x06, 0x06,
0x06, 0x06, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01,
0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01,
0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x05, 0x05, 0x05, 0x05, 0x04, 0x00 };
byte[] testReportMsg = {0};
ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
buffer.writeBytes(reportMsg);
PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
PcepMessage message = null;
message = reader.readFrom(buffer);
Assert.assertTrue("PcepMessage is not instance of PcRpt", message instanceof PcepReportMsg);
ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
message.writeTo(buf);
int readLen = buf.writerIndex() - 0;
testReportMsg = new byte[readLen];
buf.readBytes(testReportMsg, 0, readLen);
Assert.assertArrayEquals("PcRpt messages are not equal", reportMsg, testReportMsg);
}
/**
* This test case checks for SRP Object,LSP Object(symbolic path tlv),ERO Object,LSPA Object
* BandWidth Object,Metric-list,RRO Object,SRP Object,LSP Object(symbolic path tlv)
* ERO Object,Metric-list,RRO Object
* in PcRpt message.
*
* @throws PcepParseException while parsing PCEP message
*/
@Test
public void reportMessageTest31() throws PcepParseException {
byte[] reportMsg = new byte[] {0x20, 0x0a, 0x01, 0x00,
0x21, 0x10, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, //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, //ERO Object
0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x04, 0x00,
0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x20, 0x04, 0x00,
0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //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
0x08, 0x10, 0x00, 0x34, 0x01, 0x08, 0x11, 0x01, //RRO Object
0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01,
0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x06, 0x06,
0x06, 0x06, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01,
0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01,
0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x05, 0x05, 0x05, 0x05, 0x04, 0x00,
0x21, 0x10, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, //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, //ERO Object
0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x04, 0x00,
0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x20, 0x04, 0x00,
0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20, //Metric Object
0x08, 0x10, 0x00, 0x34, 0x01, 0x08, 0x11, 0x01, //RRO Object
0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01,
0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x06, 0x06,
0x06, 0x06, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01,
0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01,
0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x05, 0x05, 0x05, 0x05, 0x04, 0x00 };
byte[] testReportMsg = {0};
ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
buffer.writeBytes(reportMsg);
PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
PcepMessage message = null;
message = reader.readFrom(buffer);
Assert.assertTrue("PcepMessage is not instance of PcRpt", message instanceof PcepReportMsg);
ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
message.writeTo(buf);
int readLen = buf.writerIndex() - 0;
testReportMsg = new byte[readLen];
buf.readBytes(testReportMsg, 0, readLen);
Assert.assertArrayEquals("PcRpt messages are not equal", reportMsg, testReportMsg);
}
/**
* This test case checks for SRP Object,LSP Object(symbolic path tlv),ERO Object,LSPA Object
* BandWidth Object,Metric-list,RRO Object,SRP Object,LSP Object(symbolic path tlv)
* ERO Object,LSPA Object,Metric-list,RRO Object
* in PcRpt message.
*
* @throws PcepParseException while parsing PCEP message
*/
@Test
public void reportMessageTest32() throws PcepParseException {
byte[] reportMsg = new byte[] {0x20, 0x0a, 0x01, (byte) 0x14,
0x21, 0x10, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, //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, //ERO Object
0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x04, 0x00,
0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x20, 0x04, 0x00,
0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //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
0x08, 0x10, 0x00, 0x34, 0x01, 0x08, 0x11, 0x01, //RRO Object
0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01,
0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x06, 0x06,
0x06, 0x06, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01,
0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01,
0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x05, 0x05, 0x05, 0x05, 0x04, 0x00,
0x21, 0x10, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, //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, //ERO Object
0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x04, 0x00,
0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x20, 0x04, 0x00,
0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA Object
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20, //Metric Object
0x08, 0x10, 0x00, 0x34, 0x01, 0x08, 0x11, 0x01, //RRO Object
0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01,
0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x06, 0x06,
0x06, 0x06, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01,
0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01,
0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x05, 0x05, 0x05, 0x05, 0x04, 0x00 };
byte[] testReportMsg = {0};
ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
buffer.writeBytes(reportMsg);
PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
PcepMessage message = null;
message = reader.readFrom(buffer);
Assert.assertTrue("PcepMessage is not instance of PcRpt", message instanceof PcepReportMsg);
ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
message.writeTo(buf);
int readLen = buf.writerIndex() - 0;
testReportMsg = new byte[readLen];
buf.readBytes(testReportMsg, 0, readLen);
Assert.assertArrayEquals("PcRpt messages are not equal", reportMsg, testReportMsg);
}
/**
* This test case checks for SRP Object,LSP Object(symbolic path tlv),ERO Object,LSPA Object
* BandWidth Object,Metric-list,RRO Object,SRP Object,LSP Object(symbolic path tlv)
* ERO Object,LSPA Object,BandWidth Object,Metric-list,RRO Object
* in PcRpt message.
*
* @throws PcepParseException while parsing PCEP message
*/
@Test
public void reportMessageTest33() throws PcepParseException {
byte[] reportMsg = new byte[] {0x20, 0x0a, 0x01, (byte) 0x1c,
0x21, 0x10, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, //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, //ERO Object
0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x04, 0x00,
0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x20, 0x04, 0x00,
0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //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
0x08, 0x10, 0x00, 0x34, 0x01, 0x08, 0x11, 0x01, //RRO Object
0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01,
0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x06, 0x06,
0x06, 0x06, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01,
0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01,
0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x05, 0x05, 0x05, 0x05, 0x04, 0x00,
0x21, 0x10, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, //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, //ERO Object
0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x04, 0x00,
0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x20, 0x04, 0x00,
0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, //Bandwidth Object
0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20, //Metric Object
0x08, 0x10, 0x00, 0x34, 0x01, 0x08, 0x11, 0x01, //RRO Object
0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01,
0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x06, 0x06,
0x06, 0x06, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01,
0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01,
0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x05, 0x05, 0x05, 0x05, 0x04, 0x00 };
byte[] testReportMsg = {0};
ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
buffer.writeBytes(reportMsg);
PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
PcepMessage message = null;
message = reader.readFrom(buffer);
Assert.assertTrue("PcepMessage is not instance of PcRpt", message instanceof PcepReportMsg);
ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
message.writeTo(buf);
int readLen = buf.writerIndex() - 0;
testReportMsg = new byte[readLen];
buf.readBytes(testReportMsg, 0, readLen);
Assert.assertArrayEquals("PcRpt messages are not equal", reportMsg, testReportMsg);
}
/**
* This test case checks for SRP Object,LSP Object(symbolic path Tlv),ERO Object,LSPA Object
* BandWidth Object,Metric-list,SRP Object,LSP Object(symbolic path tlv)
* ERO Object,LSPA Object,BandWidth Object,Metric-list
* in PcRpt message.
*
* @throws PcepParseException while parsing PCEP message
*/
@Test
public void reportMessageTest34() throws PcepParseException {
byte[] reportMsg = new byte[] {0x20, 0x0a, 0x00, (byte) 0xB4,
0x21, 0x10, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, //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, //ERO Object
0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x04, 0x00,
0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x20, 0x04, 0x00,
0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //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, 0x01, //SRP Object
0x20, 0x10, 0x00, 0x10, 0x00, 0x00, 0x10, 0x04, //LSP Object
0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv
0x07, 0x10, 0x00, 0x14, //ERO Object
0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x04, 0x00,
0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x20, 0x04, 0x00,
0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //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[] testReportMsg = {0};
ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
buffer.writeBytes(reportMsg);
PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
PcepMessage message = null;
message = reader.readFrom(buffer);
Assert.assertTrue("PcepMessage is not instance of PcRpt", message instanceof PcepReportMsg);
ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
message.writeTo(buf);
int readLen = buf.writerIndex() - 0;
testReportMsg = new byte[readLen];
buf.readBytes(testReportMsg, 0, readLen);
Assert.assertArrayEquals("PcRpt messages are not equal", reportMsg, testReportMsg);
}
/**
* This test case checks for SRP Object,LSP Object)Symbolic path tlv),ERO Object,SRP Object
* LSP Object(symbolic path tlv) ERO Object,LSPA Object, BandWidth Object,Metric-list
* in PcRpt message.
*
* @throws PcepParseException while parsing PCEP message
*/
@Test
public void reportMessageTest35() throws PcepParseException {
byte[] reportMsg = new byte[] {0x20, 0x0a, 0x00, (byte) 0x8C,
0x21, 0x10, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, //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, //ERO Object
0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x04, 0x00,
0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x20, 0x04, 0x00,
0x21, 0x10, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, //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, //ERO Object
0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x04, 0x00,
0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x20, 0x04, 0x00,
0x09, 0x10, 0x00, 0x14, //LSPA Object
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, //Bandwidth Object
0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20 }; //Metric Object
byte[] testReportMsg = {0};
ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
buffer.writeBytes(reportMsg);
PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
PcepMessage message = null;
message = reader.readFrom(buffer);
Assert.assertTrue("PcepMessage is not instance of PcRpt", message instanceof PcepReportMsg);
ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
message.writeTo(buf);
int readLen = buf.writerIndex() - 0;
testReportMsg = new byte[readLen];
buf.readBytes(testReportMsg, 0, readLen);
Assert.assertArrayEquals("PcRpt messages are not equal", reportMsg, testReportMsg);
}
}
/*
* 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.Assert;
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.PcepReportMsg;
public class PcepReportMsgTest2 {
/**
* This test case checks forSRP Object,LSP Object(symbolic path tlv),ERO Object
* SRP Object,LSP Object(symbolic path tlv,ERO Object,LSPA Object,BandWidth Object,Metric-list,RRO Object
* in PcRpt message.
*
* @throws PcepParseException while parsing PCEP message
*/
@Test
public void reportMessageTest39() throws PcepParseException {
byte[] reportMsg = new byte[] {0x20, 0x0a, 0x00, (byte) 0x98,
0x21, 0x10, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, //SRP object
0x20, 0x10, 0x00, 0x10, 0x00, 0x00, 0x10, (byte) 0x83, //LSP object
0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //symbolic path tlv
0x07, 0x10, 0x00, 0x14, //ERO Object
(byte) 0x81, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x04, 0x00,
(byte) 0x81, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x20, 0x04, 0x00,
0x21, 0x10, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, //SRP object
0x20, 0x10, 0x00, 0x10, 0x00, 0x00, 0x10, (byte) 0x83, //LSP object
0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //symbolic path tlv
0x07, 0x10, 0x00, 0x14, //ERO object
(byte) 0x81, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x04, 0x00,
(byte) 0x81, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x20, 0x04, 0x00,
0x08, 0x10, 0x00, 0x34, 0x01, 0x08, 0x11, 0x01, //RRO object
0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01,
0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x06, 0x06,
0x06, 0x06, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01,
0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01,
0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x05, 0x05, 0x05, 0x05, 0x04, 0x00};
byte[] testReportMsg = {0};
ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
buffer.writeBytes(reportMsg);
PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
PcepMessage message = null;
message = reader.readFrom(buffer);
Assert.assertTrue("PcepMessage is not instance of PcRpt", message instanceof PcepReportMsg);
ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
message.writeTo(buf);
int readLen = buf.writerIndex() - 0;
testReportMsg = new byte[readLen];
buf.readBytes(testReportMsg, 0, readLen);
Assert.assertArrayEquals("PcRpt messages are not equal", reportMsg, testReportMsg);
}
/**
* This test case checks for SRP Object,LSP Object(symbolic path tlv),ERO Object
* SRP Object,LSP Object(symbolic path tlv),ERO Object
* in PcRpt message.
*
* @throws PcepParseException while parsing PCEP message
*/
@Test
public void reportMessageTest40() throws PcepParseException {
byte[] reportMsg = new byte[] {0x20, 0x0a, 0x00, (byte) 0x64,
0x21, 0x10, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, //SRP object
0x20, 0x10, 0x00, 0x10, 0x00, 0x00, 0x10, (byte) 0x83, //LSP object
0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //symbolic path tlv
0x07, 0x10, 0x00, 0x14, //ERO object
(byte) 0x81, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x04, 0x00,
(byte) 0x81, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x20, 0x04, 0x00,
0x21, 0x10, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, //SRP object
0x20, 0x10, 0x00, 0x10, 0x00, 0x00, 0x10, (byte) 0x83, //LSP object
0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //symbolic path tlv
0x07, 0x10, 0x00, 0x14, //ERO object
(byte) 0x81, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x04, 0x00,
(byte) 0x81, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x20, 0x04, 0x00};
byte[] testReportMsg = {0};
ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
buffer.writeBytes(reportMsg);
PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
PcepMessage message = null;
message = reader.readFrom(buffer);
Assert.assertTrue("PcepMessage is not instance of PcRpt", message instanceof PcepReportMsg);
ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
message.writeTo(buf);
int readLen = buf.writerIndex() - 0;
testReportMsg = new byte[readLen];
buf.readBytes(testReportMsg, 0, readLen);
Assert.assertArrayEquals("PcRpt messages are not equal", reportMsg, testReportMsg);
}
/**
* This test case checks for SRP Object,LSP Object(symbolic path tlv),ERO Object,LSPA Object
* SRP Object,LSP Object(symbolic path tlv),ERO Object,LSPA Object
* in PcRpt message.
*
* @throws PcepParseException while parsing PCEP message
*/
@Test
public void reportMessageTest41() throws PcepParseException {
byte[] reportMsg = new byte[] {0x20, 0x0a, 0x00, (byte) 0x8c,
0x21, 0x10, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, //SRP object
0x20, 0x10, 0x00, 0x10, 0x00, 0x00, 0x10, (byte) 0x83, //LSP object
0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //symbolic path tlv
0x07, 0x10, 0x00, 0x14, //ERO object
(byte) 0x81, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x04, 0x00,
(byte) 0x81, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x20, 0x04, 0x00,
0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x21, 0x10, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, //SRP object
0x20, 0x10, 0x00, 0x10, 0x00, 0x00, 0x10, (byte) 0x83, //LSP object
0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //symbolic path tlv
0x07, 0x10, 0x00, 0x14, //ERO object
(byte) 0x81, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x04, 0x00,
(byte) 0x81, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x20, 0x04, 0x00,
0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, //LSPA object
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
byte[] testReportMsg = {0};
ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
buffer.writeBytes(reportMsg);
PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
PcepMessage message = null;
message = reader.readFrom(buffer);
Assert.assertTrue("PcepMessage is not instance of PcRpt", message instanceof PcepReportMsg);
ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
message.writeTo(buf);
int readLen = buf.writerIndex() - 0;
testReportMsg = new byte[readLen];
buf.readBytes(testReportMsg, 0, readLen);
Assert.assertArrayEquals("PcRpt messages are not equal", reportMsg, testReportMsg);
}
/**
* This test case checks for SRP Object,LSP Object(symbolic path tlv),ERO Object,LSPA Object,BandWidth Object,
* Metric-list SRP Object,LSP Object(symbolic path tlv),ERO Object,LSPA Object,BandWidth Object,Metric-list,
* RRO Object
* in PcRpt message.
*
* @throws PcepParseException while parsing PCEP message
*/
@Test
public void reportMessageTest42() throws PcepParseException {
byte[] reportMsg = new byte[] {0x20, 0x0a, 0x00, (byte) 0xE8,
0x21, 0x10, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, //SRP object
0x20, 0x10, 0x00, 0x10, 0x00, 0x00, 0x10, (byte) 0x83, //LSP object
0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //symbolic path tlv
0x07, 0x10, 0x00, 0x14, //ERO object
(byte) 0x81, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x04, 0x00,
(byte) 0x81, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x20, 0x04, 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, 0x01, //SRP object
0x20, 0x10, 0x00, 0x10, 0x00, 0x00, 0x10, (byte) 0x83, //LSP object
0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //symbolic path tlv
0x07, 0x10, 0x00, 0x14, //ERO object
(byte) 0x81, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x04, 0x00,
(byte) 0x81, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x20, 0x04, 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
0x08, 0x10, 0x00, 0x34, 0x01, 0x08, 0x11, 0x01, //RRO object
0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01,
0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x06, 0x06,
0x06, 0x06, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01,
0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01,
0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x05, 0x05, 0x05, 0x05, 0x04, 0x00};
byte[] testReportMsg = {0};
ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
buffer.writeBytes(reportMsg);
PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
PcepMessage message = null;
message = reader.readFrom(buffer);
Assert.assertTrue("PcepMessage is not instance of PcRpt", message instanceof PcepReportMsg);
ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
message.writeTo(buf);
int readLen = buf.writerIndex() - 0;
testReportMsg = new byte[readLen];
buf.readBytes(testReportMsg, 0, readLen);
Assert.assertArrayEquals("PcRpt messages are not equal", reportMsg, testReportMsg);
}
}
/*
* 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.Assert;
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.PcepTEReportMsg;
public class PcepTEReportMsgTest {
/**
* This test case checks for
* TE Object (Routing Universe TLV, Local TE Node Descriptors TLV(AutonomousSystemTlv)).
* in PcTERpt message.
*
* @throws PcepParseException while parsing PCEP message
*/
@Test
public void teReportMessageTest1() throws PcepParseException {
byte[] teReportMsg = new byte[] {0x20, 0x0E, 0x00, 0x28, // common header
0x0E, 0x10, 0x00, 0x24, // TE Object Header
0x01, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x10, // TE-ID
0x00, 0x0E, 0x00, 0x08, // Routing Universe TLV
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
0x06, 0x65, 0x00, 0x0C, // Local TE Node Descriptors TLV
0x00, 0x64, 0x00, 0x04, //AutonomousSystem Tlv
0x00, 0x00, 0x00, 0x11 };
ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
buffer.writeBytes(teReportMsg);
PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
PcepMessage message = null;
message = reader.readFrom(buffer);
byte[] testReportMsg = {0};
Assert.assertTrue("PcepMessage is not instance of PcTERpt", message instanceof PcepTEReportMsg);
ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
message.writeTo(buf);
int readLen = buf.writerIndex() - 0;
testReportMsg = new byte[readLen];
buf.readBytes(testReportMsg, 0, readLen);
Assert.assertArrayEquals("PcTERpt messages are not equal", teReportMsg, testReportMsg);
}
/**
* This test case checks for
*T E Object (Routing Universe TLV, Local TE Node Descriptors TLV(AutonomousSystemTlv)) with different TE-ID.
* in PcTERpt message.
*
* @throws PcepParseException while parsing PCEP message
*/
@Test
public void teReportMessageTest2() throws PcepParseException {
byte[] teReportMsg = new byte[] {0x20, 0x0E, 0x00, 0x28, // common header
0x0E, 0x10, 0x00, 0x24, // TE Object Header
0x01, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x10, // TE-ID
0x00, 0x0E, 0x00, 0x08, // Routing Universe TLV
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
0x06, 0x65, 0x00, 0x0C, // Local TE Node Descriptors TLV
0x00, 0x64, 0x00, 0x04, //AutonomousSystemTlv
0x00, 0x00, 0x00, 0x11 };
ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
buffer.writeBytes(teReportMsg);
PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
PcepMessage message = null;
message = reader.readFrom(buffer);
byte[] testReportMsg = {0};
Assert.assertTrue("PcepMessage is not instance of PcTERpt", message instanceof PcepTEReportMsg);
ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
message.writeTo(buf);
int readLen = buf.writerIndex() - 0;
testReportMsg = new byte[readLen];
buf.readBytes(testReportMsg, 0, readLen);
Assert.assertArrayEquals("PcTERpt messages are not equal", teReportMsg, testReportMsg);
}
/**
* This test case checks for TE Object (Routing Universe TLV)
* in PcTERpt message.
*
* @throws PcepParseException while parsing PCEP message
*/
@Test
public void teReportMessageTest3() throws PcepParseException {
byte[] teReportMsg = new byte[] {0x20, 0x0E, 0x00, 0x1c, // common header
0x0E, 0x10, 0x00, 0x18, // TE Object Header
0x01, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x10, // TE-ID
0x00, 0x0E, 0x00, 0x08, // Routing Universe TLV
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01 };
ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
buffer.writeBytes(teReportMsg);
PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
PcepMessage message = null;
message = reader.readFrom(buffer);
byte[] testReportMsg = {0};
Assert.assertTrue("PcepMessage is not instance of PcTERpt", message instanceof PcepTEReportMsg);
ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
message.writeTo(buf);
int readLen = buf.writerIndex() - 0;
testReportMsg = new byte[readLen];
buf.readBytes(testReportMsg, 0, readLen);
Assert.assertArrayEquals("PcTERpt messages are not equal", teReportMsg, testReportMsg);
}
/**
* This test case checks for
* TE Object (Routing Universe TLV,Local TE Node Descriptors TLV(AutonomousSystemTlv, BGPLSidentifierTlv.
* OSPFareaIDsubTlv, RouterIDSubTlv)).
* in PcTERpt message.
*
* @throws PcepParseException while parsing PCEP message
*/
@Test
public void teReportMessageTest4() throws PcepParseException {
byte[] teReportMsg = new byte[] {0x20, 0x0E, 0x00, 0x44, // common header
0x0E, 0x10, 0x00, 0x40, // TE Object Header
0x01, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x10, // TE-ID
0x00, 0x0E, 0x00, 0x08, // Routing Universe TLV
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x01,
0x06, 0x65, 0x00, 0x28, // Local TE Node Descriptors TLV
0x00, 0x64, 0x00, 0x04, //AutonomousSystemTlv
0x00, 0x00, 0x00, 0x11,
0x00, 0x11, 0x00, 0x04, //BGPLSidentifierTlv
0x00, 0x00, 0x00, 0x11,
0x02, 0x58, 0x00, 0x04, //OSPFareaIDsubTlv
0x00, 0x00, 0x00, 0x11,
0x03, (byte) 0xE8, 0x00, 0x08, //RouterIDSubTlv
0x00, 0x00, 0x00, 0x11,
0x00, 0x00, 0x00, 0x11};
ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
buffer.writeBytes(teReportMsg);
PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
PcepMessage message = null;
message = reader.readFrom(buffer);
byte[] testReportMsg = {0};
Assert.assertTrue("PcepMessage is not instance of PcTERpt", message instanceof PcepTEReportMsg);
ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
message.writeTo(buf);
int readLen = buf.writerIndex() - 0;
testReportMsg = new byte[readLen];
buf.readBytes(testReportMsg, 0, readLen);
Assert.assertArrayEquals("PcTERpt messages are not equal", teReportMsg, testReportMsg);
}
/**
* This test case checks for
* TE Object (Routing Universe TLV,Local TE Node Descriptors TLV(BGPLSidentifierTlv
* OSPFareaIDsubTlv, RouterIDSubTlv))
* in PcTERpt message.
*
* @throws PcepParseException while parsing PCEP message
*/
@Test
public void teReportMessageTest5() throws PcepParseException {
byte[] teReportMsg = new byte[] {0x20, 0x0E, 0x00, 0x3C, // common header
0x0E, 0x10, 0x00, 0x38, // TE Object Header
0x01, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x10, // TE-ID
0x00, 0x0E, 0x00, 0x08, // Routing Universe TLV
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x01,
0x06, 0x65, 0x00, 0x20, // Local TE Node Descriptors TLV
0x00, 0x11, 0x00, 0x04, //BGPLSidentifierTlv
0x00, 0x00, 0x00, 0x11,
0x02, 0x58, 0x00, 0x04, //OSPFareaIDsubTlv
0x00, 0x00, 0x00, 0x11,
0x03, (byte) 0xE8, 0x00, 0x08, //RouterIDSubTlv
0x00, 0x00, 0x00, 0x11,
0x00, 0x00, 0x00, 0x11};
ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
buffer.writeBytes(teReportMsg);
PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
PcepMessage message = null;
message = reader.readFrom(buffer);
byte[] testReportMsg = {0};
Assert.assertTrue("PcepMessage is not instance of PcTERpt", message instanceof PcepTEReportMsg);
ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
message.writeTo(buf);
int readLen = buf.writerIndex() - 0;
testReportMsg = new byte[readLen];
buf.readBytes(testReportMsg, 0, readLen);
Assert.assertArrayEquals("PcTERpt messages are not equal", teReportMsg, testReportMsg);
}
/**
* This test case checks for TE Object (Routing Universe TLV,Local TE Node Descriptors TLV(OSPFareaIDsubTlv,
* RouterIDSubTlv))
* in PcTERpt message.
*
* @throws PcepParseException while parsing PCEP message
*/
@Test
public void teReportMessageTest6() throws PcepParseException {
byte[] teReportMsg = new byte[] {0x20, 0x0E, 0x00, 0x34, // common header
0x0E, 0x10, 0x00, 0x30, // TE Object Header
0x01, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x10, // TE-ID
0x00, 0x0E, 0x00, 0x08, // Routing Universe TLV
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x01,
0x06, 0x65, 0x00, 0x18, // Local TE Node Descriptors TLV
0x02, 0x58, 0x00, 0x04, //OSPFareaIDsubTlv
0x00, 0x00, 0x00, 0x11,
0x03, (byte) 0xE8, 0x00, 0x08, //RouterIDSubTlv
0x00, 0x00, 0x00, 0x11,
0x00, 0x00, 0x00, 0x11};
ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
buffer.writeBytes(teReportMsg);
PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
PcepMessage message = null;
message = reader.readFrom(buffer);
byte[] testReportMsg = {0};
Assert.assertTrue("PcepMessage is not instance of PcTERpt", message instanceof PcepTEReportMsg);
ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
message.writeTo(buf);
int readLen = buf.writerIndex() - 0;
testReportMsg = new byte[readLen];
buf.readBytes(testReportMsg, 0, readLen);
Assert.assertArrayEquals("PcTERpt messages are not equal", teReportMsg, testReportMsg);
}
/**
* This test case checks for TE Object (Routing Universe TLV,Local TE Node Descriptors TLV(RouterIDSubTlv)).
* in PcTERpt message.
*
* @throws PcepParseException while parsing PCEP message
*/
@Test
public void teReportMessageTest7() throws PcepParseException {
byte[] teReportMsg = new byte[] {0x20, 0x0E, 0x00, 0x2C, // common header
0x0E, 0x10, 0x00, 0x28, // TE Object Header
0x01, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x10, // TE-ID
0x00, 0x0E, 0x00, 0x08, // Routing Universe TLV
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x01,
0x06, 0x65, 0x00, 0x10, // Local TE Node Descriptors TLV
0x03, (byte) 0xE8, 0x00, 0x08, //RouterIDSubTlv
0x00, 0x00, 0x00, 0x11,
0x00, 0x00, 0x00, 0x11};
ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
buffer.writeBytes(teReportMsg);
PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
PcepMessage message = null;
message = reader.readFrom(buffer);
byte[] testReportMsg = {0};
Assert.assertTrue("PcepMessage is not instance of PcTERpt", message instanceof PcepTEReportMsg);
ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
message.writeTo(buf);
int readLen = buf.writerIndex() - 0;
testReportMsg = new byte[readLen];
buf.readBytes(testReportMsg, 0, readLen);
Assert.assertArrayEquals("PcTERpt messages are not equal", teReportMsg, testReportMsg);
}
/**
* This test case checks for TE Object (Routing Universe TLV,Local TE Node Descriptors TLV)
* in PcTERpt message.
*
* @throws PcepParseException while parsing PCEP message
*/
@Test
public void teReportMessageTest8() throws PcepParseException {
byte[] teReportMsg = new byte[] {0x20, 0x0E, 0x00, 0x20, // common header
0x0E, 0x10, 0x00, 0x1C, // TE Object Header
0x01, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x10, // TE-ID
0x00, 0x0E, 0x00, 0x08, // Routing Universe TLV
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x01,
0x06, 0x65, 0x00, 0x04 // Local TE Node Descriptors TLV
};
ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
buffer.writeBytes(teReportMsg);
PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
PcepMessage message = null;
message = reader.readFrom(buffer);
byte[] testReportMsg = {0};
Assert.assertTrue("PcepMessage is not instance of PcTERpt", message instanceof PcepTEReportMsg);
ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
message.writeTo(buf);
int readLen = buf.writerIndex() - 0;
testReportMsg = new byte[readLen];
buf.readBytes(testReportMsg, 0, readLen);
Assert.assertArrayEquals("PcTERpt messages are not equal", teReportMsg, testReportMsg);
}
/**
* This test case checks for
* TE Object (Routing Universe TLV,Local TE Node Descriptors TLV(AutonomousSystemTlv, BGPLSidentifierTlv.
* OSPFareaIDsubTlv, RouterIDSubTlv), RemoteTENodeDescriptorsTLV(AutonomousSystemTlv, BGPLSidentifierTlv.
* OSPFareaIDsubTlv, RouterIDSubTlv)).
* in PcTERpt message.
*
* @throws PcepParseException while parsing PCEP message
*/
@Test
public void teReportMessageTest9() throws PcepParseException {
byte[] teReportMsg = new byte[] {0x20, 0x0E, 0x00, 0x6C, // common header
0x0E, 0x10, 0x00, 0x68, // TE Object Header
0x01, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x10, // TE-ID
0x00, 0x0E, 0x00, 0x08, // Routing Universe TLV
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x01,
0x06, 0x65, 0x00, 0x28, // Local TE Node Descriptors TLV
0x00, 0x64, 0x00, 0x04, //AutonomousSystemTlv
0x00, 0x00, 0x00, 0x11,
0x00, 0x11, 0x00, 0x04, //BGPLSidentifierTlv
0x00, 0x00, 0x00, 0x11,
0x02, 0x58, 0x00, 0x04, //OSPFareaIDsubTlv
0x00, 0x00, 0x00, 0x11,
0x03, (byte) 0xE8, 0x00, 0x08, //RouterIDSubTlv
0x00, 0x00, 0x00, 0x11,
0x00, 0x00, 0x00, 0x11,
0x03, (byte) 0xEB, 0x00, 0x28, //RemoteTENodeDescriptorsTLV
0x00, 0x64, 0x00, 0x04, //AutonomousSystemTlv
0x00, 0x00, 0x00, 0x11,
0x00, 0x11, 0x00, 0x04, //BGPLSidentifierTlv
0x00, 0x00, 0x00, 0x11,
0x02, 0x58, 0x00, 0x04, //OSPFareaIDsubTlv
0x00, 0x00, 0x00, 0x11,
0x03, (byte) 0xE8, 0x00, 0x08, //RouterIDSubTlv
0x00, 0x00, 0x00, 0x11,
0x00, 0x00, 0x00, 0x11
};
ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
buffer.writeBytes(teReportMsg);
PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
PcepMessage message = null;
message = reader.readFrom(buffer);
byte[] testReportMsg = {0};
Assert.assertTrue("PcepMessage is not instance of PcTERpt", message instanceof PcepTEReportMsg);
ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
message.writeTo(buf);
int readLen = buf.writerIndex() - 0;
testReportMsg = new byte[readLen];
buf.readBytes(testReportMsg, 0, readLen);
Assert.assertArrayEquals("PcTERpt messages are not equal", teReportMsg, testReportMsg);
}
/**
* This test case checks for
* TE Object (Routing Universe TLV,Local TE Node Descriptors TLV(AutonomousSystemTlv, BGPLSidentifierTlv
* OSPFareaIDsubTlv, RouterIDSubTlv), RemoteTENodeDescriptorsTLV(BGPLSidentifierTlv
* OSPFareaIDsubTlv, RouterIDSubTlv))
* in PcTERpt message.
*
* @throws PcepParseException while parsing PCEP message
*/
@Test
public void teReportMessageTest10() throws PcepParseException {
byte[] teReportMsg = new byte[] {0x20, 0x0E, 0x00, 0x64, // common header
0x0E, 0x10, 0x00, 0x60, // TE Object Header
0x01, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x10, // TE-ID
0x00, 0x0E, 0x00, 0x08, // Routing Universe TLV
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x01,
0x06, 0x65, 0x00, 0x28, // Local TE Node Descriptors TLV
0x00, 0x64, 0x00, 0x04, //AutonomousSystemTlv
0x00, 0x00, 0x00, 0x11,
0x00, 0x11, 0x00, 0x04, //BGPLSidentifierTlv
0x00, 0x00, 0x00, 0x11,
0x02, 0x58, 0x00, 0x04, //OSPFareaIDsubTlv
0x00, 0x00, 0x00, 0x11,
0x03, (byte) 0xE8, 0x00, 0x08, //RouterIDSubTlv
0x00, 0x00, 0x00, 0x11,
0x00, 0x00, 0x00, 0x11,
0x03, (byte) 0xEB, 0x00, 0x20, //RemoteTENodeDescriptorsTLV
0x00, 0x11, 0x00, 0x04, //BGPLSidentifierTlv
0x00, 0x00, 0x00, 0x11,
0x02, 0x58, 0x00, 0x04, //OSPFareaIDsubTlv
0x00, 0x00, 0x00, 0x11,
0x03, (byte) 0xE8, 0x00, 0x08, //RouterIDSubTlv
0x00, 0x00, 0x00, 0x11,
0x00, 0x00, 0x00, 0x11
};
ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
buffer.writeBytes(teReportMsg);
PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
PcepMessage message = null;
message = reader.readFrom(buffer);
byte[] testReportMsg = {0};
Assert.assertTrue("PcepMessage is not instance of PcTERpt", message instanceof PcepTEReportMsg);
ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
message.writeTo(buf);
int readLen = buf.writerIndex() - 0;
testReportMsg = new byte[readLen];
buf.readBytes(testReportMsg, 0, readLen);
Assert.assertArrayEquals("PcTERpt messages are not equal", teReportMsg, testReportMsg);
}
/**
* This test case checks for
* TE Object (Routing Universe TLV,Local TE Node Descriptors TLV(AutonomousSystemTlv, BGPLSidentifierTlv
* OSPFareaIDsubTlv, RouterIDSubTlv), RemoteTENodeDescriptorsTLV(OSPFareaIDsubTlv, RouterIDSubTlv))
* in PcTERpt message.
*
* @throws PcepParseException while parsing PCEP message
*/
@Test
public void teReportMessageTest11() throws PcepParseException {
byte[] teReportMsg = new byte[] {0x20, 0x0E, 0x00, 0x5C, // common header
0x0E, 0x10, 0x00, 0x58, // TE Object Header
0x01, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x10, // TE-ID
0x00, 0x0E, 0x00, 0x08, // Routing Universe TLV
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x01,
0x06, 0x65, 0x00, 0x28, // Local TE Node Descriptors TLV
0x00, 0x64, 0x00, 0x04, //AutonomousSystemTlv
0x00, 0x00, 0x00, 0x11,
0x00, 0x11, 0x00, 0x04, //BGPLSidentifierTlv
0x00, 0x00, 0x00, 0x11,
0x02, 0x58, 0x00, 0x04, //OSPFareaIDsubTlv
0x00, 0x00, 0x00, 0x11,
0x03, (byte) 0xE8, 0x00, 0x08, //RouterIDSubTlv
0x00, 0x00, 0x00, 0x11,
0x00, 0x00, 0x00, 0x11,
0x03, (byte) 0xEB, 0x00, 0x18, //RemoteTENodeDescriptorsTLV
0x02, 0x58, 0x00, 0x04, //OSPFareaIDsubTlv
0x00, 0x00, 0x00, 0x11,
0x03, (byte) 0xE8, 0x00, 0x08, //RouterIDSubTlv
0x00, 0x00, 0x00, 0x11,
0x00, 0x00, 0x00, 0x11
};
ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
buffer.writeBytes(teReportMsg);
PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
PcepMessage message = null;
message = reader.readFrom(buffer);
byte[] testReportMsg = {0};
Assert.assertTrue("PcepMessage is not instance of PcTERpt", message instanceof PcepTEReportMsg);
ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
message.writeTo(buf);
int readLen = buf.writerIndex() - 0;
testReportMsg = new byte[readLen];
buf.readBytes(testReportMsg, 0, readLen);
Assert.assertArrayEquals("PcTERpt messages are not equal", teReportMsg, testReportMsg);
}
/**
* This test case checks for
* TE Object (Routing Universe TLV,Local TE Node Descriptors TLV(AutonomousSystemTlv, BGPLSidentifierTlv
* OSPFareaIDsubTlv, RouterIDSubTlv), RemoteTENodeDescriptorsTLV(RouterIDSubTlv))
* in PcTERpt message.
*
* @throws PcepParseException while parsing PCEP message
*/
@Test
public void teReportMessageTest12() throws PcepParseException {
byte[] teReportMsg = new byte[] {0x20, 0x0E, 0x00, 0x54, // common header
0x0E, 0x10, 0x00, 0x50, // TE Object Header
0x01, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x10, // TE-ID
0x00, 0x0E, 0x00, 0x08, // Routing Universe TLV
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x01,
0x06, 0x65, 0x00, 0x28, // Local TE Node Descriptors TLV
0x00, 0x64, 0x00, 0x04, //AutonomousSystemTlv
0x00, 0x00, 0x00, 0x11,
0x00, 0x11, 0x00, 0x04, //BGPLSidentifierTlv
0x00, 0x00, 0x00, 0x11,
0x02, 0x58, 0x00, 0x04, //OSPFareaIDsubTlv
0x00, 0x00, 0x00, 0x11,
0x03, (byte) 0xE8, 0x00, 0x08, //RouterIDSubTlv
0x00, 0x00, 0x00, 0x11,
0x00, 0x00, 0x00, 0x11,
0x03, (byte) 0xEB, 0x00, 0x10, //RemoteTENodeDescriptorsTLV
0x03, (byte) 0xE8, 0x00, 0x08, //RouterIDSubTlv
0x00, 0x00, 0x00, 0x11,
0x00, 0x00, 0x00, 0x11
};
ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
buffer.writeBytes(teReportMsg);
PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
PcepMessage message = null;
message = reader.readFrom(buffer);
byte[] testReportMsg = {0};
Assert.assertTrue("PcepMessage is not instance of PcTERpt", message instanceof PcepTEReportMsg);
ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
message.writeTo(buf);
int readLen = buf.writerIndex() - 0;
testReportMsg = new byte[readLen];
buf.readBytes(testReportMsg, 0, readLen);
Assert.assertArrayEquals("PcTERpt messages are not equal", teReportMsg, testReportMsg);
}
/**
* This test case checks for
* TE Object (Routing Universe TLV,Local TE Node Descriptors TLV(AutonomousSystemTlv, BGPLSidentifierTlv
* OSPFareaIDsubTlv, RouterIDSubTlv), RemoteTENodeDescriptorsTLV)
* in PcTERpt message.
*
* @throws PcepParseException while parsing PCEP message
*/
@Test
public void teReportMessageTest13() throws PcepParseException {
byte[] teReportMsg = new byte[] {0x20, 0x0E, 0x00, 0x48, // common header
0x0E, 0x10, 0x00, 0x44, // TE Object Header
0x01, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x10, // TE-ID
0x00, 0x0E, 0x00, 0x08, // Routing Universe TLV
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x01,
0x06, 0x65, 0x00, 0x28, // Local TE Node Descriptors TLV
0x00, 0x64, 0x00, 0x04, //AutonomousSystemTlv
0x00, 0x00, 0x00, 0x11,
0x00, 0x11, 0x00, 0x04, //BGPLSidentifierTlv
0x00, 0x00, 0x00, 0x11,
0x02, 0x58, 0x00, 0x04, //OSPFareaIDsubTlv
0x00, 0x00, 0x00, 0x11,
0x03, (byte) 0xE8, 0x00, 0x08, //RouterIDSubTlv
0x00, 0x00, 0x00, 0x11,
0x00, 0x00, 0x00, 0x11,
0x03, (byte) 0xEB, 0x00, 0x04, //RemoteTENodeDescriptorsTLV
};
ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
buffer.writeBytes(teReportMsg);
PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
PcepMessage message = null;
message = reader.readFrom(buffer);
byte[] testReportMsg = {0};
Assert.assertTrue("PcepMessage is not instance of PcTERpt", message instanceof PcepTEReportMsg);
ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
message.writeTo(buf);
int readLen = buf.writerIndex() - 0;
testReportMsg = new byte[readLen];
buf.readBytes(testReportMsg, 0, readLen);
Assert.assertArrayEquals("PcTERpt messages are not equal", teReportMsg, testReportMsg);
}
/**
* This test case checks for
* TE Object (Routing Universe TLV,Local TE Node Descriptors TLV(AutonomousSystemTlv, BGPLSidentifierTlv
* OSPFareaIDsubTlv, RouterIDSubTlv), RemoteTENodeDescriptorsTLV(AutonomousSystemTlv, BGPLSidentifierTlv
* OSPFareaIDsubTlv, RouterIDSubTlv), TELinkDescriptorsTLV(LinkLocalRemoteIdentifiersTlv
* IPv4InterfaceAddressTlv, IPv4NeighborAddressTlv))
* in PcTERpt message.
*
* @throws PcepParseException while parsing PCEP message
*/
@Test
public void teReportMessageTest14() throws PcepParseException {
byte[] teReportMsg = new byte[] {0x20, 0x0E, 0x00, (byte) 0x8C, // common header
0x0E, 0x10, 0x00, (byte) 0x88, // TE Object Header
0x01, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x10, // TE-ID
0x00, 0x0E, 0x00, 0x08, // Routing Universe TLV
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x01,
0x06, 0x65, 0x00, 0x28, // Local TE Node Descriptors TLV
0x00, 0x64, 0x00, 0x04, //AutonomousSystemTlv
0x00, 0x00, 0x00, 0x11,
0x00, 0x11, 0x00, 0x04, //BGPLSidentifierTlv
0x00, 0x00, 0x00, 0x11,
0x02, 0x58, 0x00, 0x04, //OSPFareaIDsubTlv
0x00, 0x00, 0x00, 0x11,
0x03, (byte) 0xE8, 0x00, 0x08, //RouterIDSubTlv
0x00, 0x00, 0x00, 0x11,
0x00, 0x00, 0x00, 0x11,
0x03, (byte) 0xEB, 0x00, 0x28, //RemoteTENodeDescriptorsTLV
0x00, 0x64, 0x00, 0x04, //AutonomousSystemTlv
0x00, 0x00, 0x00, 0x11,
0x00, 0x11, 0x00, 0x04, //BGPLSidentifierTlv
0x00, 0x00, 0x00, 0x11,
0x02, 0x58, 0x00, 0x04, //OSPFareaIDsubTlv
0x00, 0x00, 0x00, 0x11,
0x03, (byte) 0xE8, 0x00, 0x08, //RouterIDSubTlv
0x00, 0x00, 0x00, 0x11,
0x00, 0x00, 0x00, 0x11,
0x04, 0x2E, 0x00, 0x20, //TELinkDescriptorsTLV
0x00, 0x04, 0x00, 0x08, //LinkLocalRemoteIdentifiersTlv
0x01, 0x11, 0x00, 0x09,
0x01, 0x21, 0x00, 0x09,
0x00, 0x06, 0x00, 0x04, //IPv4InterfaceAddressTlv
0x01, 0x01, 0x01, 0x01,
0x00, 0x08, 0x00, 0x04, //IPv4NeighborAddressTlv
0x01, 0x011, 0x01, 0x10
};
ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
buffer.writeBytes(teReportMsg);
PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
PcepMessage message = null;
message = reader.readFrom(buffer);
byte[] testReportMsg = {0};
Assert.assertTrue("PcepMessage is not instance of PcTERpt", message instanceof PcepTEReportMsg);
ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
message.writeTo(buf);
int readLen = buf.writerIndex() - 0;
testReportMsg = new byte[readLen];
buf.readBytes(testReportMsg, 0, readLen);
Assert.assertArrayEquals("PcTERpt messages are not equal", teReportMsg, testReportMsg);
}
/**
* This test case checks for
* TE Object (Routing Universe TLV,Local TE Node Descriptors TLV(AutonomousSystemTlv, BGPLSidentifierTlv
* OSPFareaIDsubTlv, RouterIDSubTlv), RemoteTENodeDescriptorsTLV(AutonomousSystemTlv, BGPLSidentifierTlv
* OSPFareaIDsubTlv, RouterIDSubTlv), TELinkDescriptorsTLV(
* IPv4InterfaceAddressTlv, IPv4NeighborAddressTlv))
* in PcTERpt message.
*
* @throws PcepParseException while parsing PCEP message
*/
@Test
public void teReportMessageTest15() throws PcepParseException {
byte[] teReportMsg = new byte[] {0x20, 0x0E, 0x00, (byte) 0x80, // common header
0x0E, 0x10, 0x00, (byte) 0x7C, // TE Object Header
0x01, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x10, // TE-ID
0x00, 0x0E, 0x00, 0x08, // Routing Universe TLV
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x01,
0x06, 0x65, 0x00, 0x28, // Local TE Node Descriptors TLV
0x00, 0x64, 0x00, 0x04, //AutonomousSystemTlv
0x00, 0x00, 0x00, 0x11,
0x00, 0x11, 0x00, 0x04, //BGPLSidentifierTlv
0x00, 0x00, 0x00, 0x11,
0x02, 0x58, 0x00, 0x04, //OSPFareaIDsubTlv
0x00, 0x00, 0x00, 0x11,
0x03, (byte) 0xE8, 0x00, 0x08, //RouterIDSubTlv
0x00, 0x00, 0x00, 0x11,
0x00, 0x00, 0x00, 0x11,
0x03, (byte) 0xEB, 0x00, 0x28, //RemoteTENodeDescriptorsTLV
0x00, 0x64, 0x00, 0x04, //AutonomousSystemTlv
0x00, 0x00, 0x00, 0x11,
0x00, 0x11, 0x00, 0x04, //BGPLSidentifierTlv
0x00, 0x00, 0x00, 0x11,
0x02, 0x58, 0x00, 0x04, //OSPFareaIDsubTlv
0x00, 0x00, 0x00, 0x11,
0x03, (byte) 0xE8, 0x00, 0x08, //RouterIDSubTlv
0x00, 0x00, 0x00, 0x11,
0x00, 0x00, 0x00, 0x11,
0x04, 0x2E, 0x00, 0x14, //TELinkDescriptorsTLV
0x00, 0x06, 0x00, 0x04, //IPv4InterfaceAddressTlv
0x01, 0x01, 0x01, 0x01,
0x00, 0x08, 0x00, 0x04, //IPv4NeighborAddressTlv
0x01, 0x011, 0x01, 0x10
};
ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
buffer.writeBytes(teReportMsg);
PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
PcepMessage message = null;
message = reader.readFrom(buffer);
byte[] testReportMsg = {0};
Assert.assertTrue("PcepMessage is not instance of PcTERpt", message instanceof PcepTEReportMsg);
ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
message.writeTo(buf);
int readLen = buf.writerIndex() - 0;
testReportMsg = new byte[readLen];
buf.readBytes(testReportMsg, 0, readLen);
Assert.assertArrayEquals("PcTERpt messages are not equal", teReportMsg, testReportMsg);
}
/**
* This test case checks for
* TE Object (Routing Universe TLV,Local TE Node Descriptors TLV(AutonomousSystemTlv, BGPLSidentifierTlv
* OSPFareaIDsubTlv, RouterIDSubTlv), RemoteTENodeDescriptorsTLV(AutonomousSystemTlv, BGPLSidentifierTlv
* OSPFareaIDsubTlv, RouterIDSubTlv), TELinkDescriptorsTLV(IPv4NeighborAddressTlv))
* in PcTERpt message.
*
* @throws PcepParseException while parsing PCEP message
*/
@Test
public void teReportMessageTest16() throws PcepParseException {
byte[] teReportMsg = new byte[] {0x20, 0x0E, 0x00, (byte) 0x78, // common header
0x0E, 0x10, 0x00, (byte) 0x74, // TE Object Header
0x01, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x10, // TE-ID
0x00, 0x0E, 0x00, 0x08, // Routing Universe TLV
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x01,
0x06, 0x65, 0x00, 0x28, // Local TE Node Descriptors TLV
0x00, 0x64, 0x00, 0x04, //AutonomousSystemTlv
0x00, 0x00, 0x00, 0x11,
0x00, 0x11, 0x00, 0x04, //BGPLSidentifierTlv
0x00, 0x00, 0x00, 0x11,
0x02, 0x58, 0x00, 0x04, //OSPFareaIDsubTlv
0x00, 0x00, 0x00, 0x11,
0x03, (byte) 0xE8, 0x00, 0x08, //RouterIDSubTlv
0x00, 0x00, 0x00, 0x11,
0x00, 0x00, 0x00, 0x11,
0x03, (byte) 0xEB, 0x00, 0x28, //RemoteTENodeDescriptorsTLV
0x00, 0x64, 0x00, 0x04, //AutonomousSystemTlv
0x00, 0x00, 0x00, 0x11,
0x00, 0x11, 0x00, 0x04, //BGPLSidentifierTlv
0x00, 0x00, 0x00, 0x11,
0x02, 0x58, 0x00, 0x04, //OSPFareaIDsubTlv
0x00, 0x00, 0x00, 0x11,
0x03, (byte) 0xE8, 0x00, 0x08, //RouterIDSubTlv
0x00, 0x00, 0x00, 0x11,
0x00, 0x00, 0x00, 0x11,
0x04, 0x2E, 0x00, 0x0C, //TELinkDescriptorsTLV
0x00, 0x08, 0x00, 0x04, //IPv4NeighborAddressTlv
0x01, 0x011, 0x01, 0x10
};
ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
buffer.writeBytes(teReportMsg);
PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
PcepMessage message = null;
message = reader.readFrom(buffer);
byte[] testReportMsg = {0};
Assert.assertTrue("PcepMessage is not instance of PcTERpt", message instanceof PcepTEReportMsg);
ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
message.writeTo(buf);
int readLen = buf.writerIndex() - 0;
testReportMsg = new byte[readLen];
buf.readBytes(testReportMsg, 0, readLen);
Assert.assertArrayEquals("PcTERpt messages are not equal", teReportMsg, testReportMsg);
}
/**
* This test case checks for
* TE Object (Routing Universe TLV,Local TE Node Descriptors TLV(AutonomousSystemTlv, BGPLSidentifierTlv
* OSPFareaIDsubTlv, RouterIDSubTlv), RemoteTENodeDescriptorsTLV(AutonomousSystemTlv, BGPLSidentifierTlv
* OSPFareaIDsubTlv, RouterIDSubTlv), TELinkDescriptorsTLV)
* in PcTERpt message.
*
* @throws PcepParseException while parsing PCEP message
*/
@Test
public void teReportMessageTest17() throws PcepParseException {
byte[] teReportMsg = new byte[] {0x20, 0x0E, 0x00, (byte) 0x70, // common header
0x0E, 0x10, 0x00, (byte) 0x6C, // TE Object Header
0x01, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x10, // TE-ID
0x00, 0x0E, 0x00, 0x08, // Routing Universe TLV
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x01,
0x06, 0x65, 0x00, 0x28, // Local TE Node Descriptors TLV
0x00, 0x64, 0x00, 0x04, //AutonomousSystemTlv
0x00, 0x00, 0x00, 0x11,
0x00, 0x11, 0x00, 0x04, //BGPLSidentifierTlv
0x00, 0x00, 0x00, 0x11,
0x02, 0x58, 0x00, 0x04, //OSPFareaIDsubTlv
0x00, 0x00, 0x00, 0x11,
0x03, (byte) 0xE8, 0x00, 0x08, //RouterIDSubTlv
0x00, 0x00, 0x00, 0x11,
0x00, 0x00, 0x00, 0x11,
0x03, (byte) 0xEB, 0x00, 0x28, //RemoteTENodeDescriptorsTLV
0x00, 0x64, 0x00, 0x04, //AutonomousSystemTlv
0x00, 0x00, 0x00, 0x11,
0x00, 0x11, 0x00, 0x04, //BGPLSidentifierTlv
0x00, 0x00, 0x00, 0x11,
0x02, 0x58, 0x00, 0x04, //OSPFareaIDsubTlv
0x00, 0x00, 0x00, 0x11,
0x03, (byte) 0xE8, 0x00, 0x08, //RouterIDSubTlv
0x00, 0x00, 0x00, 0x11,
0x00, 0x00, 0x00, 0x11,
0x04, 0x2E, 0x00, 0x04, //TELinkDescriptorsTLV
};
ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
buffer.writeBytes(teReportMsg);
PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
PcepMessage message = null;
message = reader.readFrom(buffer);
byte[] testReportMsg = {0};
Assert.assertTrue("PcepMessage is not instance of PcTERpt", message instanceof PcepTEReportMsg);
ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
message.writeTo(buf);
int readLen = buf.writerIndex() - 0;
testReportMsg = new byte[readLen];
buf.readBytes(testReportMsg, 0, readLen);
Assert.assertArrayEquals("PcTERpt messages are not equal", teReportMsg, testReportMsg);
}
/**
* This test case checks for
* TE Object (Routing Universe TLV,Local TE Node Descriptors TLV(AutonomousSystemTlv, BGPLSidentifierTlv
* OSPFareaIDsubTlv, RouterIDSubTlv), RemoteTENodeDescriptorsTLV(AutonomousSystemTlv, BGPLSidentifierTlv
* OSPFareaIDsubTlv, RouterIDSubTlv), TELinkDescriptorsTLV(LinkLocalRemoteIdentifiersTlv
* IPv4InterfaceAddressTlv, IPv4NeighborAddressTlv))
* in PcTERpt message.
*
* @throws PcepParseException while parsing PCEP message
*/
@Test
public void teReportMessageTest18() throws PcepParseException {
byte[] teReportMsg = new byte[] {0x20, 0x0E, 0x00, (byte) 0xC0, // common header
0x0E, 0x10, 0x00, (byte) 0xbC, // TE Object Header
0x01, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x10, // TE-ID
0x00, 0x0E, 0x00, 0x08, // Routing Universe TLV
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x01,
0x06, 0x65, 0x00, 0x28, // Local TE Node Descriptors TLV
0x00, 0x64, 0x00, 0x04, //AutonomousSystemTlv
0x00, 0x00, 0x00, 0x11,
0x00, 0x11, 0x00, 0x04, //BGPLSidentifierTlv
0x00, 0x00, 0x00, 0x11,
0x02, 0x58, 0x00, 0x04, //OSPFareaIDsubTlv
0x00, 0x00, 0x00, 0x11,
0x03, (byte) 0xE8, 0x00, 0x08, //RouterIDSubTlv
0x00, 0x00, 0x00, 0x11,
0x00, 0x00, 0x00, 0x11,
0x03, (byte) 0xEB, 0x00, 0x28, //RemoteTENodeDescriptorsTLV
0x00, 0x64, 0x00, 0x04, //AutonomousSystemTlv
0x00, 0x00, 0x00, 0x11,
0x00, 0x11, 0x00, 0x04, //BGPLSidentifierTlv
0x00, 0x00, 0x00, 0x11,
0x02, 0x58, 0x00, 0x04, //OSPFareaIDsubTlv
0x00, 0x00, 0x00, 0x11,
0x03, (byte) 0xE8, 0x00, 0x08, //RouterIDSubTlv
0x00, 0x00, 0x00, 0x11,
0x00, 0x00, 0x00, 0x11,
0x04, 0x2E, 0x00, 0x20, //TELinkDescriptorsTLV
0x00, 0x04, 0x00, 0x08, //LinkLocalRemoteIdentifiersTlv
0x01, 0x11, 0x00, 0x09,
0x01, 0x21, 0x00, 0x09,
0x00, 0x06, 0x00, 0x04, //IPv4InterfaceAddressTlv
0x01, 0x01, 0x01, 0x01,
0x00, 0x08, 0x00, 0x04, //IPv4NeighborAddressTlv
0x01, 0x011, 0x01, 0x10,
0x04, (byte) 0xF3, 0x00, 0x34, //TENodeAttributesTlv
0x00, 0x0E, 0x00, 0x01, //NodeFlagBitsTlv
(byte) 0x90, 0x00, 0x00, 0x00,
0x03, (byte) 0xE9, 0x00, 0x04, //OpaqueNodeAttributeTlv
0x01, 0x011, 0x01, 0x10,
0x03, (byte) 0xEF, 0x00, 0x08, //NodeNameTlv
0x08, 0x00, 0x01, 0x09,
0x08, 0x00, 0x01, 0x09,
0x00, 0x6B, 0x00, 0x08, //ISISAreaIdentifierTlv
0x20, 0x01, 0x22, 0x01,
0x20, 0x01, 0x22, 0x01,
0x00, (byte) 0x86, 0x00, 0x04, //IPv4TERouterIdOfLocalNodeTlv
0x00, 0x01, 0x01, 0x02
};
ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
buffer.writeBytes(teReportMsg);
PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
PcepMessage message = null;
message = reader.readFrom(buffer);
byte[] testReportMsg = {0};
Assert.assertTrue("PcepMessage is not instance of PcTERpt", message instanceof PcepTEReportMsg);
ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
message.writeTo(buf);
int readLen = buf.writerIndex() - 0;
testReportMsg = new byte[readLen];
buf.readBytes(testReportMsg, 0, readLen);
Assert.assertArrayEquals("PcTERpt messages are not equal", teReportMsg, testReportMsg);
}
/**
* This test case checks for
* TE Object (Routing Universe TLV,Local TE Node Descriptors TLV(AutonomousSystemTlv, BGPLSidentifierTlv
* OSPFareaIDsubTlv, RouterIDSubTlv), RemoteTENodeDescriptorsTLV(AutonomousSystemTlv, BGPLSidentifierTlv
* OSPFareaIDsubTlv, RouterIDSubTlv), TELinkDescriptorsTLV(LinkLocalRemoteIdentifiersTlv
* IPv4InterfaceAddressTlv, IPv4NeighborAddressTlv), TENodeAttributesTlv(NodeFlagBitsTlv
* OpaqueNodeAttributeTlv, NodeNameTlv, ISISAreaIdentifierTlv, IPv4TERouterIdOfLocalNodeTlv))
* in PcTERpt message.
*
* @throws PcepParseException while parsing PCEP message
*/
@Test
public void teReportMessageTest19() throws PcepParseException {
byte[] teReportMsg = new byte[] {0x20, 0x0E, 0x00, (byte) 0xC0, // common header
0x0E, 0x10, 0x00, (byte) 0xBC, // TE Object Header
0x01, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x10, // TE-ID
0x00, 0x0E, 0x00, 0x08, // Routing Universe TLV
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x01,
0x06, 0x65, 0x00, 0x28, // Local TE Node Descriptors TLV
0x00, 0x64, 0x00, 0x04, //AutonomousSystemTlv
0x00, 0x00, 0x00, 0x11,
0x00, 0x11, 0x00, 0x04, //BGPLSidentifierTlv
0x00, 0x00, 0x00, 0x11,
0x02, 0x58, 0x00, 0x04, //OSPFareaIDsubTlv
0x00, 0x00, 0x00, 0x11,
0x03, (byte) 0xE8, 0x00, 0x08, //RouterIDSubTlv
0x00, 0x00, 0x00, 0x11,
0x00, 0x00, 0x00, 0x11,
0x03, (byte) 0xEB, 0x00, 0x28, //RemoteTENodeDescriptorsTLV
0x00, 0x64, 0x00, 0x04, //AutonomousSystemTlv
0x00, 0x00, 0x00, 0x11,
0x00, 0x11, 0x00, 0x04, //BGPLSidentifierTlv
0x00, 0x00, 0x00, 0x11,
0x02, 0x58, 0x00, 0x04, //OSPFareaIDsubTlv
0x00, 0x00, 0x00, 0x11,
0x03, (byte) 0xE8, 0x00, 0x08, //RouterIDSubTlv
0x00, 0x00, 0x00, 0x11,
0x00, 0x00, 0x00, 0x11,
0x04, 0x2E, 0x00, 0x20, //TELinkDescriptorsTLV
0x00, 0x04, 0x00, 0x08, //LinkLocalRemoteIdentifiersTlv
0x01, 0x11, 0x00, 0x09,
0x01, 0x21, 0x00, 0x09,
0x00, 0x06, 0x00, 0x04, //IPv4InterfaceAddressTlv
0x01, 0x01, 0x01, 0x01,
0x00, 0x08, 0x00, 0x04, //IPv4NeighborAddressTlv
0x01, 0x011, 0x01, 0x10,
0x04, (byte) 0xF3, 0x00, 0x34, //TENodeAttributesTlv
0x00, 0x0E, 0x00, 0x01, //NodeFlagBitsTlv
(byte) 0x90, 0x00, 0x00, 0x00,
0x03, (byte) 0xE9, 0x00, 0x04, //OpaqueNodeAttributeTlv
0x01, 0x011, 0x01, 0x10,
0x03, (byte) 0xEF, 0x00, 0x08, //NodeNameTlv
0x08, 0x00, 0x01, 0x09,
0x08, 0x00, 0x01, 0x09,
0x00, 0x6B, 0x00, 0x08, //ISISAreaIdentifierTlv
0x20, 0x01, 0x22, 0x01,
0x20, 0x01, 0x22, 0x01,
0x00, (byte) 0x86, 0x00, 0x04, //IPv4TERouterIdOfLocalNodeTlv
0x00, 0x01, 0x01, 0x02
};
ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
buffer.writeBytes(teReportMsg);
PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
PcepMessage message = null;
message = reader.readFrom(buffer);
byte[] testReportMsg = {0};
Assert.assertTrue("PcepMessage is not instance of PcTERpt", message instanceof PcepTEReportMsg);
ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
message.writeTo(buf);
int readLen = buf.writerIndex() - 0;
testReportMsg = new byte[readLen];
buf.readBytes(testReportMsg, 0, readLen);
Assert.assertArrayEquals("PcTERpt messages are not equal", teReportMsg, testReportMsg);
}
/**
* This test case checks for
* TE Object (Routing Universe TLV,Local TE Node Descriptors TLV(AutonomousSystemTlv, BGPLSidentifierTlv
* OSPFareaIDsubTlv, RouterIDSubTlv), RemoteTENodeDescriptorsTLV(AutonomousSystemTlv, BGPLSidentifierTlv
* OSPFareaIDsubTlv, RouterIDSubTlv), TELinkDescriptorsTLV(LinkLocalRemoteIdentifiersTlv
* IPv4InterfaceAddressTlv, IPv4NeighborAddressTlv), TENodeAttributesTlv(OpaqueNodeAttributeTlv
* NodeNameTlv, ISISAreaIdentifierTlv, IPv4TERouterIdOfLocalNodeTlv))
* in PcTERpt message.
*
* @throws PcepParseException while parsing PCEP message
*/
@Test
public void teReportMessageTest20() throws PcepParseException {
byte[] teReportMsg = new byte[] {0x20, 0x0E, 0x00, (byte) 0xB8, // common header
0x0E, 0x10, 0x00, (byte) 0xB4, // TE Object Header
0x01, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x10, // TE-ID
0x00, 0x0E, 0x00, 0x08, // Routing Universe TLV
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x01,
0x06, 0x65, 0x00, 0x28, // Local TE Node Descriptors TLV
0x00, 0x64, 0x00, 0x04, //AutonomousSystemTlv
0x00, 0x00, 0x00, 0x11,
0x00, 0x11, 0x00, 0x04, //BGPLSidentifierTlv
0x00, 0x00, 0x00, 0x11,
0x02, 0x58, 0x00, 0x04, //OSPFareaIDsubTlv
0x00, 0x00, 0x00, 0x11,
0x03, (byte) 0xE8, 0x00, 0x08, //RouterIDSubTlv
0x00, 0x00, 0x00, 0x11,
0x00, 0x00, 0x00, 0x11,
0x03, (byte) 0xEB, 0x00, 0x28, //RemoteTENodeDescriptorsTLV
0x00, 0x64, 0x00, 0x04, //AutonomousSystemTlv
0x00, 0x00, 0x00, 0x11,
0x00, 0x11, 0x00, 0x04, //BGPLSidentifierTlv
0x00, 0x00, 0x00, 0x11,
0x02, 0x58, 0x00, 0x04, //OSPFareaIDsubTlv
0x00, 0x00, 0x00, 0x11,
0x03, (byte) 0xE8, 0x00, 0x08, //RouterIDSubTlv
0x00, 0x00, 0x00, 0x11,
0x00, 0x00, 0x00, 0x11,
0x04, 0x2E, 0x00, 0x20, //TELinkDescriptorsTLV
0x00, 0x04, 0x00, 0x08, //LinkLocalRemoteIdentifiersTlv
0x01, 0x11, 0x00, 0x09,
0x01, 0x21, 0x00, 0x09,
0x00, 0x06, 0x00, 0x04, //IPv4InterfaceAddressTlv
0x01, 0x01, 0x01, 0x01,
0x00, 0x08, 0x00, 0x04, //IPv4NeighborAddressTlv
0x01, 0x011, 0x01, 0x10,
0x04, (byte) 0xF3, 0x00, 0x2C, //TENodeAttributesTlv
0x03, (byte) 0xE9, 0x00, 0x04, //OpaqueNodeAttributeTlv
0x01, 0x011, 0x01, 0x10,
0x03, (byte) 0xEF, 0x00, 0x08, //NodeNameTlv
0x08, 0x00, 0x01, 0x09,
0x08, 0x00, 0x01, 0x09,
0x00, 0x6B, 0x00, 0x08, //ISISAreaIdentifierTlv
0x20, 0x01, 0x22, 0x01,
0x20, 0x01, 0x22, 0x01,
0x00, (byte) 0x86, 0x00, 0x04, //IPv4TERouterIdOfLocalNodeTlv
0x00, 0x01, 0x01, 0x02
};
ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
buffer.writeBytes(teReportMsg);
PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
PcepMessage message = null;
message = reader.readFrom(buffer);
byte[] testReportMsg = {0};
Assert.assertTrue("PcepMessage is not instance of PcTERpt", message instanceof PcepTEReportMsg);
ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
message.writeTo(buf);
int readLen = buf.writerIndex() - 0;
testReportMsg = new byte[readLen];
buf.readBytes(testReportMsg, 0, readLen);
Assert.assertArrayEquals("PcTERpt messages are not equal", teReportMsg, testReportMsg);
}
/**
* This test case checks for
* TE Object (Routing Universe TLV,Local TE Node Descriptors TLV(AutonomousSystemTlv, BGPLSidentifierTlv
* OSPFareaIDsubTlv, RouterIDSubTlv), RemoteTENodeDescriptorsTLV(AutonomousSystemTlv, BGPLSidentifierTlv
* OSPFareaIDsubTlv, RouterIDSubTlv), TELinkDescriptorsTLV(LinkLocalRemoteIdentifiersTlv.
* IPv4InterfaceAddressTlv, IPv4NeighborAddressTlv), TENodeAttributesTlv(OpaqueNodeAttributeTlv
* ISISAreaIdentifierTlv, IPv4TERouterIdOfLocalNodeTlv))
* in PcTERpt message.
*
* @throws PcepParseException while parsing PCEP message
*/
@Test
public void teReportMessageTest21() throws PcepParseException {
byte[] teReportMsg = new byte[] {0x20, 0x0E, 0x00, (byte) 0xAC, // common header
0x0E, 0x10, 0x00, (byte) 0xA8, // TE Object Header
0x01, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x10, // TE-ID
0x00, 0x0E, 0x00, 0x08, // Routing Universe TLV
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x01,
0x06, 0x65, 0x00, 0x28, // Local TE Node Descriptors TLV
0x00, 0x64, 0x00, 0x04, //AutonomousSystemTlv
0x00, 0x00, 0x00, 0x11,
0x00, 0x11, 0x00, 0x04, //BGPLSidentifierTlv
0x00, 0x00, 0x00, 0x11,
0x02, 0x58, 0x00, 0x04, //OSPFareaIDsubTlv
0x00, 0x00, 0x00, 0x11,
0x03, (byte) 0xE8, 0x00, 0x08, //RouterIDSubTlv
0x00, 0x00, 0x00, 0x11,
0x00, 0x00, 0x00, 0x11,
0x03, (byte) 0xEB, 0x00, 0x28, //RemoteTENodeDescriptorsTLV
0x00, 0x64, 0x00, 0x04, //AutonomousSystemTlv
0x00, 0x00, 0x00, 0x11,
0x00, 0x11, 0x00, 0x04, //BGPLSidentifierTlv
0x00, 0x00, 0x00, 0x11,
0x02, 0x58, 0x00, 0x04, //OSPFareaIDsubTlv
0x00, 0x00, 0x00, 0x11,
0x03, (byte) 0xE8, 0x00, 0x08, //RouterIDSubTlv
0x00, 0x00, 0x00, 0x11,
0x00, 0x00, 0x00, 0x11,
0x04, 0x2E, 0x00, 0x20, //TELinkDescriptorsTLV
0x00, 0x04, 0x00, 0x08, //LinkLocalRemoteIdentifiersTlv
0x01, 0x11, 0x00, 0x09,
0x01, 0x21, 0x00, 0x09,
0x00, 0x06, 0x00, 0x04, //IPv4InterfaceAddressTlv
0x01, 0x01, 0x01, 0x01,
0x00, 0x08, 0x00, 0x04, //IPv4NeighborAddressTlv
0x01, 0x011, 0x01, 0x10,
0x04, (byte) 0xF3, 0x00, 0x20, //TENodeAttributesTlv
0x03, (byte) 0xE9, 0x00, 0x04, //OpaqueNodeAttributeTlv
0x01, 0x011, 0x01, 0x10,
0x00, 0x6B, 0x00, 0x08, //ISISAreaIdentifierTlv
0x20, 0x01, 0x22, 0x01,
0x20, 0x01, 0x22, 0x01,
0x00, (byte) 0x86, 0x00, 0x04, //IPv4TERouterIdOfLocalNodeTlv
0x00, 0x01, 0x01, 0x02
};
ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
buffer.writeBytes(teReportMsg);
PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
PcepMessage message = null;
message = reader.readFrom(buffer);
byte[] testReportMsg = {0};
Assert.assertTrue("PcepMessage is not instance of PcTERpt", message instanceof PcepTEReportMsg);
ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
message.writeTo(buf);
int readLen = buf.writerIndex() - 0;
testReportMsg = new byte[readLen];
buf.readBytes(testReportMsg, 0, readLen);
Assert.assertArrayEquals("PcTERpt messages are not equal", teReportMsg, testReportMsg);
}
/**
* This test case checks for
* TE Object (Routing Universe TLV,Local TE Node Descriptors TLV(AutonomousSystemTlv, BGPLSidentifierTlv.
* OSPFareaIDsubTlv, RouterIDSubTlv), RemoteTENodeDescriptorsTLV(AutonomousSystemTlv, BGPLSidentifierTlv.
* OSPFareaIDsubTlv, RouterIDSubTlv), TELinkDescriptorsTLV(LinkLocalRemoteIdentifiersTlv.
* IPv4InterfaceAddressTlv, IPv4NeighborAddressTlv), TENodeAttributesTlv(NodeFlagBitsTlv.
* OpaqueNodeAttributeTlv, NodeNameTlv, ISISAreaIdentifierTlv, IPv4TERouterIdOfLocalNodeTlv).
* TELinkAttributesTlv(IPv4TERouterIdOfRemoteNodeTlv, IPv6TERouterIdofRemoteNodeTlv, AdministrativeGroupTlv.
* MaximumLinkBandwidthTlv, MaximumReservableLinkBandwidthTlv, UnreservedBandwidthTlv, TEDefaultMetricTlv.
* LinkProtectionTypeTlv, MPLSProtocolMaskTlv, IGPMetricTlv:, SharedRiskLinkGroupTlv.
* OpaqueLinkAttributeTlv, LinkNameTlv)).
* in PcTERpt message.
*
* @throws PcepParseException while parsing PCEP message
*/
@Test
public void teReportMessageTest22() throws PcepParseException {
byte[] teReportMsg = new byte[] {0x20, 0x0E, 0x01, (byte) 0x20, // common header
0x0E, 0x10, 0x01, (byte) 0x1C, // TE Object Header
0x01, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x10, // TE-ID
0x00, 0x0E, 0x00, 0x08, // Routing Universe TLV
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x01,
0x06, 0x65, 0x00, 0x28, // Local TE Node Descriptors TLV
0x00, 0x64, 0x00, 0x04, //AutonomousSystemTlv
0x00, 0x00, 0x00, 0x11,
0x00, 0x11, 0x00, 0x04, //BGPLSidentifierTlv
0x00, 0x00, 0x00, 0x11,
0x02, 0x58, 0x00, 0x04, //OSPFareaIDsubTlv
0x00, 0x00, 0x00, 0x11,
0x03, (byte) 0xE8, 0x00, 0x08, //RouterIDSubTlv
0x00, 0x00, 0x00, 0x11,
0x00, 0x00, 0x00, 0x11,
0x03, (byte) 0xEB, 0x00, 0x28, //RemoteTENodeDescriptorsTLV
0x00, 0x64, 0x00, 0x04, //AutonomousSystemTlv
0x00, 0x00, 0x00, 0x11,
0x00, 0x11, 0x00, 0x04, //BGPLSidentifierTlv
0x00, 0x00, 0x00, 0x11,
0x02, 0x58, 0x00, 0x04, //OSPFareaIDsubTlv
0x00, 0x00, 0x00, 0x11,
0x03, (byte) 0xE8, 0x00, 0x08, //RouterIDSubTlv
0x00, 0x00, 0x00, 0x11,
0x00, 0x00, 0x00, 0x11,
0x04, 0x2E, 0x00, 0x20, //TELinkDescriptorsTLV
0x00, 0x04, 0x00, 0x08, //LinkLocalRemoteIdentifiersTlv
0x01, 0x11, 0x00, 0x09,
0x01, 0x21, 0x00, 0x09,
0x00, 0x06, 0x00, 0x04, //IPv4InterfaceAddressTlv
0x01, 0x01, 0x01, 0x01,
0x00, 0x08, 0x00, 0x04, //IPv4NeighborAddressTlv
0x01, 0x011, 0x01, 0x10,
0x04, (byte) 0xF3, 0x00, 0x2C, //TENodeAttributesTlv
0x03, (byte) 0xE9, 0x00, 0x04, //OpaqueNodeAttributeTlv
0x01, 0x011, 0x01, 0x10,
0x03, (byte) 0xEF, 0x00, 0x08, //NodeNameTlv
0x08, 0x00, 0x01, 0x09,
0x08, 0x00, 0x01, 0x09,
0x00, 0x6B, 0x00, 0x08, //ISISAreaIdentifierTlv
0x20, 0x01, 0x22, 0x01,
0x20, 0x01, 0x22, 0x01,
0x00, (byte) 0x86, 0x00, 0x04, //IPv4TERouterIdOfLocalNodeTlv
0x00, 0x01, 0x01, 0x02,
0x07, 0x69, 0x00, 0x68, //TELinkAttributesTlv
0x05, 0x3C, 0x00, 0x04, //IPv4TERouterIdOfRemoteNodeTlv
0x00, 0x07, 0x08, 0x00,
0x00, 0x03, 0x00, 0x04, //AdministrativeGroupTlv
0x00, 0x09, 0x08, 0x00,
0x00, 0x09, 0x00, 0x04, //MaximumLinkBandwidthTlv
0x00, 0x09, 0x00, 0x00,
0x00, 0x0a, 0x00, 0x04, //MaximumReservableLinkBandwidthTlv
0x00, 0x10, 0x00, 0x00,
0x00, 0x0b, 0x00, 0x04, //UnreservedBandwidthTlv
0x00, 0x00, (byte) 0x90, 0x00,
0x34, 0x58, 0x00, 0x04, //TEDefaultMetricTlv
0x00, (byte) 0x99, 0x09, 0x00,
0x00, 0x14, 0x00, 0x02, //LinkProtectionTypeTlv
0x09, 0x00, 0x00, 0x00,
0x04, 0x46, 0x00, 0x01, //MPLSProtocolMaskTlv
(byte) 0x80, 0x00, 0x00, 0x00,
0x04, 0x47, 0x00, 0x03, //IGPMetricTlv
0x09, (byte) 0x89, 0x07, 0x00,
0x04, 0x48, 0x00, 0x08, //SharedRiskLinkGroupTlv
0x04, 0x47, 0x00, 0x03,
0x04, 0x47, 0x00, 0x03, //OpaqueLinkAttributeTlv
0x04, 0x49, 0x00, 0x04,
0x04, 0x47, 0x00, 0x03,
0x04, 0x4A, 0x00, 0x04, //LinkNameTlv
0x04, 0x47, 0x00, 0x03
};
ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
buffer.writeBytes(teReportMsg);
PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
PcepMessage message = null;
message = reader.readFrom(buffer);
byte[] testReportMsg = {0};
Assert.assertTrue("PcepMessage is not instance of PcTERpt", message instanceof PcepTEReportMsg);
ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
message.writeTo(buf);
int readLen = buf.writerIndex() - 0;
testReportMsg = new byte[readLen];
buf.readBytes(testReportMsg, 0, readLen);
Assert.assertArrayEquals("PcTERpt messages are not equal", teReportMsg, testReportMsg);
}
/**
* This test case checks for
* TE Object (Routing Universe TLV,Local TE Node Descriptors TLV(AutonomousSystemTlv, BGPLSidentifierTlv
* OSPFareaIDsubTlv, RouterIDSubTlv), RemoteTENodeDescriptorsTLV(AutonomousSystemTlv, BGPLSidentifierTlv
* OSPFareaIDsubTlv, RouterIDSubTlv), TELinkDescriptorsTLV(LinkLocalRemoteIdentifiersTlv
* IPv4InterfaceAddressTlv, IPv4NeighborAddressTlv), TENodeAttributesTlv(NodeFlagBitsTlv
* OpaqueNodeAttributeTlv, NodeNameTlv, ISISAreaIdentifierTlv, IPv4TERouterIdOfLocalNodeTlv)
* TELinkAttributesTlv(IPv4TERouterIdOfRemoteNodeTlv, IPv6TERouterIdofRemoteNodeTlv, AdministrativeGroupTlv
* MaximumLinkBandwidthTlv, MaximumReservableLinkBandwidthTlv, UnreservedBandwidthTlv, TEDefaultMetricTlv
* LinkProtectionTypeTlv, MPLSProtocolMaskTlv, IGPMetricTlv:, SharedRiskLinkGroupTlv
* OpaqueLinkAttributeTlv))
* in PcTERpt message.
*
* @throws PcepParseException while parsing PCEP message
*/
@Test
public void teReportMessageTest23() throws PcepParseException {
byte[] teReportMsg = new byte[] {0x20, 0x0E, 0x01, (byte) 0x18, // common header
0x0E, 0x10, 0x01, (byte) 0x14, // TE Object Header
0x01, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x10, // TE-ID
0x00, 0x0E, 0x00, 0x08, // Routing Universe TLV
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x01,
0x06, 0x65, 0x00, 0x28, // Local TE Node Descriptors TLV
0x00, 0x64, 0x00, 0x04, //AutonomousSystemTlv
0x00, 0x00, 0x00, 0x11,
0x00, 0x11, 0x00, 0x04, //BGPLSidentifierTlv
0x00, 0x00, 0x00, 0x11,
0x02, 0x58, 0x00, 0x04, //OSPFareaIDsubTlv
0x00, 0x00, 0x00, 0x11,
0x03, (byte) 0xE8, 0x00, 0x08, //RouterIDSubTlv
0x00, 0x00, 0x00, 0x11,
0x00, 0x00, 0x00, 0x11,
0x03, (byte) 0xEB, 0x00, 0x28, //RemoteTENodeDescriptorsTLV
0x00, 0x64, 0x00, 0x04, //AutonomousSystemTlv
0x00, 0x00, 0x00, 0x11,
0x00, 0x11, 0x00, 0x04, //BGPLSidentifierTlv
0x00, 0x00, 0x00, 0x11,
0x02, 0x58, 0x00, 0x04, //OSPFareaIDsubTlv
0x00, 0x00, 0x00, 0x11,
0x03, (byte) 0xE8, 0x00, 0x08, //RouterIDSubTlv
0x00, 0x00, 0x00, 0x11,
0x00, 0x00, 0x00, 0x11,
0x04, 0x2E, 0x00, 0x20, //TELinkDescriptorsTLV
0x00, 0x04, 0x00, 0x08, //LinkLocalRemoteIdentifiersTlv
0x01, 0x11, 0x00, 0x09,
0x01, 0x21, 0x00, 0x09,
0x00, 0x06, 0x00, 0x04, //IPv4InterfaceAddressTlv
0x01, 0x01, 0x01, 0x01,
0x00, 0x08, 0x00, 0x04, //IPv4NeighborAddressTlv
0x01, 0x011, 0x01, 0x10,
0x04, (byte) 0xF3, 0x00, 0x2C, //TENodeAttributesTlv
0x03, (byte) 0xE9, 0x00, 0x04, //OpaqueNodeAttributeTlv
0x01, 0x011, 0x01, 0x10,
0x03, (byte) 0xEF, 0x00, 0x08, //NodeNameTlv
0x08, 0x00, 0x01, 0x09,
0x08, 0x00, 0x01, 0x09,
0x00, 0x6B, 0x00, 0x08, //ISISAreaIdentifierTlv
0x20, 0x01, 0x22, 0x01,
0x20, 0x01, 0x22, 0x01,
0x00, (byte) 0x86, 0x00, 0x04, //IPv4TERouterIdOfLocalNodeTlv
0x00, 0x01, 0x01, 0x02,
0x07, 0x69, 0x00, 0x60, //TELinkAttributesTlv
0x05, 0x3C, 0x00, 0x04, //IPv4TERouterIdOfRemoteNodeTlv
0x00, 0x07, 0x08, 0x00,
0x00, 0x03, 0x00, 0x04, //AdministrativeGroupTlv
0x00, 0x09, 0x08, 0x00,
0x00, 0x09, 0x00, 0x04, //MaximumLinkBandwidthTlv
0x00, 0x09, 0x00, 0x00,
0x00, 0x0a, 0x00, 0x04, //MaximumReservableLinkBandwidthTlv
0x00, 0x10, 0x00, 0x00,
0x00, 0x0b, 0x00, 0x04, //UnreservedBandwidthTlv
0x00, 0x00, (byte) 0x90, 0x00,
0x34, 0x58, 0x00, 0x04, //TEDefaultMetricTlv
0x00, (byte) 0x99, 0x09, 0x00,
0x00, 0x14, 0x00, 0x02, //LinkProtectionTypeTlv
0x09, 0x00, 0x00, 0x00,
0x04, 0x46, 0x00, 0x01, //MPLSProtocolMaskTlv
(byte) 0x80, 0x00, 0x00, 0x00,
0x04, 0x47, 0x00, 0x03, //IGPMetricTlv
0x09, (byte) 0x89, 0x07, 0x00,
0x04, 0x48, 0x00, 0x08, //SharedRiskLinkGroupTlv
0x04, 0x47, 0x00, 0x03,
0x04, 0x47, 0x00, 0x03, //OpaqueLinkAttributeTlv
0x04, 0x49, 0x00, 0x04,
0x04, 0x47, 0x00, 0x03
};
ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
buffer.writeBytes(teReportMsg);
PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
PcepMessage message = null;
message = reader.readFrom(buffer);
byte[] testReportMsg = {0};
Assert.assertTrue("PcepMessage is not instance of PcTERpt", message instanceof PcepTEReportMsg);
ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
message.writeTo(buf);
int readLen = buf.writerIndex() - 0;
testReportMsg = new byte[readLen];
buf.readBytes(testReportMsg, 0, readLen);
Assert.assertArrayEquals("PcTERpt messages are not equal", teReportMsg, testReportMsg);
}
/**
* This test case checks for
* TE Object (Routing Universe TLV,Local TE Node Descriptors TLV(AutonomousSystemTlv, BGPLSidentifierTlv
* OSPFareaIDsubTlv, RouterIDSubTlv), RemoteTENodeDescriptorsTLV(AutonomousSystemTlv, BGPLSidentifierTlv
* OSPFareaIDsubTlv, RouterIDSubTlv), TELinkDescriptorsTLV(LinkLocalRemoteIdentifiersTlv
* IPv4InterfaceAddressTlv, IPv4NeighborAddressTlv), TENodeAttributesTlv(NodeFlagBitsTlv
* OpaqueNodeAttributeTlv, NodeNameTlv, ISISAreaIdentifierTlv, IPv4TERouterIdOfLocalNodeTlv)
* TELinkAttributesTlv(IPv4TERouterIdOfRemoteNodeTlv, IPv6TERouterIdofRemoteNodeTlv, AdministrativeGroupTlv
* MaximumLinkBandwidthTlv, MaximumReservableLinkBandwidthTlv, UnreservedBandwidthTlv, TEDefaultMetricTlv
* LinkProtectionTypeTlv, MPLSProtocolMaskTlv, IGPMetricTlv:, SharedRiskLinkGroupTlv))
* in PcTERpt message.
*
* @throws PcepParseException while parsing PCEP message
*/
@Test
public void teReportMessageTest24() throws PcepParseException {
byte[] teReportMsg = new byte[] {0x20, 0x0E, 0x01, (byte) 0x10, // common header
0x0E, 0x10, 0x01, (byte) 0x0C, // TE Object Header
0x01, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x10, // TE-ID
0x00, 0x0E, 0x00, 0x08, // Routing Universe TLV
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x01,
0x06, 0x65, 0x00, 0x28, // Local TE Node Descriptors TLV
0x00, 0x64, 0x00, 0x04, //AutonomousSystemTlv
0x00, 0x00, 0x00, 0x11,
0x00, 0x11, 0x00, 0x04, //BGPLSidentifierTlv
0x00, 0x00, 0x00, 0x11,
0x02, 0x58, 0x00, 0x04, //OSPFareaIDsubTlv
0x00, 0x00, 0x00, 0x11,
0x03, (byte) 0xE8, 0x00, 0x08, //RouterIDSubTlv
0x00, 0x00, 0x00, 0x11,
0x00, 0x00, 0x00, 0x11,
0x03, (byte) 0xEB, 0x00, 0x28, //RemoteTENodeDescriptorsTLV
0x00, 0x64, 0x00, 0x04, //AutonomousSystemTlv
0x00, 0x00, 0x00, 0x11,
0x00, 0x11, 0x00, 0x04, //BGPLSidentifierTlv
0x00, 0x00, 0x00, 0x11,
0x02, 0x58, 0x00, 0x04, //OSPFareaIDsubTlv
0x00, 0x00, 0x00, 0x11,
0x03, (byte) 0xE8, 0x00, 0x08, //RouterIDSubTlv
0x00, 0x00, 0x00, 0x11,
0x00, 0x00, 0x00, 0x11,
0x04, 0x2E, 0x00, 0x20, //TELinkDescriptorsTLV
0x00, 0x04, 0x00, 0x08, //LinkLocalRemoteIdentifiersTlv
0x01, 0x11, 0x00, 0x09,
0x01, 0x21, 0x00, 0x09,
0x00, 0x06, 0x00, 0x04, //IPv4InterfaceAddressTlv
0x01, 0x01, 0x01, 0x01,
0x00, 0x08, 0x00, 0x04, //IPv4NeighborAddressTlv
0x01, 0x011, 0x01, 0x10,
0x04, (byte) 0xF3, 0x00, 0x2C, //TENodeAttributesTlv
0x03, (byte) 0xE9, 0x00, 0x04, //OpaqueNodeAttributeTlv
0x01, 0x011, 0x01, 0x10,
0x03, (byte) 0xEF, 0x00, 0x08, //NodeNameTlv
0x08, 0x00, 0x01, 0x09,
0x08, 0x00, 0x01, 0x09,
0x00, 0x6B, 0x00, 0x08, //ISISAreaIdentifierTlv
0x20, 0x01, 0x22, 0x01,
0x20, 0x01, 0x22, 0x01,
0x00, (byte) 0x86, 0x00, 0x04, //IPv4TERouterIdOfLocalNodeTlv
0x00, 0x01, 0x01, 0x02,
0x07, 0x69, 0x00, 0x58, //TELinkAttributesTlv
0x05, 0x3C, 0x00, 0x04, //IPv4TERouterIdOfRemoteNodeTlv
0x00, 0x07, 0x08, 0x00,
0x00, 0x03, 0x00, 0x04, //AdministrativeGroupTlv
0x00, 0x09, 0x08, 0x00,
0x00, 0x09, 0x00, 0x04, //MaximumLinkBandwidthTlv
0x00, 0x09, 0x00, 0x00,
0x00, 0x0a, 0x00, 0x04, //MaximumReservableLinkBandwidthTlv
0x00, 0x10, 0x00, 0x00,
0x00, 0x0b, 0x00, 0x04, //UnreservedBandwidthTlv
0x00, 0x00, (byte) 0x90, 0x00,
0x34, 0x58, 0x00, 0x04, //TEDefaultMetricTlv
0x00, (byte) 0x99, 0x09, 0x00,
0x00, 0x14, 0x00, 0x02, //LinkProtectionTypeTlv
0x09, 0x00, 0x00, 0x00,
0x04, 0x46, 0x00, 0x01, //MPLSProtocolMaskTlv
(byte) 0x80, 0x00, 0x00, 0x00,
0x04, 0x47, 0x00, 0x03, //IGPMetricTlv
0x09, (byte) 0x89, 0x07, 0x00,
0x04, 0x48, 0x00, 0x08, //SharedRiskLinkGroupTlv
0x04, 0x47, 0x00, 0x03,
0x04, 0x47, 0x00, 0x03
};
ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
buffer.writeBytes(teReportMsg);
PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
PcepMessage message = null;
message = reader.readFrom(buffer);
byte[] testReportMsg = {0};
Assert.assertTrue("PcepMessage is not instance of PcTERpt", message instanceof PcepTEReportMsg);
ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
message.writeTo(buf);
int readLen = buf.writerIndex() - 0;
testReportMsg = new byte[readLen];
buf.readBytes(testReportMsg, 0, readLen);
Assert.assertArrayEquals("PcTERpt messages are not equal", teReportMsg, testReportMsg);
}
/**
* This test case checks for
* TE Object (Routing Universe TLV,Local TE Node Descriptors TLV(AutonomousSystemTlv, BGPLSidentifierTlv
* OSPFareaIDsubTlv, RouterIDSubTlv), RemoteTENodeDescriptorsTLV(AutonomousSystemTlv, BGPLSidentifierTlv
* OSPFareaIDsubTlv, RouterIDSubTlv), TELinkDescriptorsTLV(LinkLocalRemoteIdentifiersTlv
* IPv4InterfaceAddressTlv, IPv4NeighborAddressTlv), TENodeAttributesTlv(NodeFlagBitsTlv
* OpaqueNodeAttributeTlv, NodeNameTlv, ISISAreaIdentifierTlv, IPv4TERouterIdOfLocalNodeTlv)
* TELinkAttributesTlv(IPv4TERouterIdOfRemoteNodeTlv, IPv6TERouterIdofRemoteNodeTlv, AdministrativeGroupTlv
* MaximumLinkBandwidthTlv, MaximumReservableLinkBandwidthTlv, UnreservedBandwidthTlv, TEDefaultMetricTlv
* LinkProtectionTypeTlv, MPLSProtocolMaskTlv, IGPMetricTlv))
* in PcTERpt message.
*
* @throws PcepParseException while parsing PCEP message
*/
@Test
public void teReportMessageTest25() throws PcepParseException {
byte[] teReportMsg = new byte[] {0x20, 0x0E, 0x01, 0x04, // common header
0x0E, 0x10, 0x01, 0x00, // TE Object Header
0x01, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x10, // TE-ID
0x00, 0x0E, 0x00, 0x08, // Routing Universe TLV
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x01,
0x06, 0x65, 0x00, 0x28, // Local TE Node Descriptors TLV
0x00, 0x64, 0x00, 0x04, //AutonomousSystemTlv
0x00, 0x00, 0x00, 0x11,
0x00, 0x11, 0x00, 0x04, //BGPLSidentifierTlv
0x00, 0x00, 0x00, 0x11,
0x02, 0x58, 0x00, 0x04, //OSPFareaIDsubTlv
0x00, 0x00, 0x00, 0x11,
0x03, (byte) 0xE8, 0x00, 0x08, //RouterIDSubTlv
0x00, 0x00, 0x00, 0x11,
0x00, 0x00, 0x00, 0x11,
0x03, (byte) 0xEB, 0x00, 0x28, //RemoteTENodeDescriptorsTLV
0x00, 0x64, 0x00, 0x04, //AutonomousSystemTlv
0x00, 0x00, 0x00, 0x11,
0x00, 0x11, 0x00, 0x04, //BGPLSidentifierTlv
0x00, 0x00, 0x00, 0x11,
0x02, 0x58, 0x00, 0x04, //OSPFareaIDsubTlv
0x00, 0x00, 0x00, 0x11,
0x03, (byte) 0xE8, 0x00, 0x08, //RouterIDSubTlv
0x00, 0x00, 0x00, 0x11,
0x00, 0x00, 0x00, 0x11,
0x04, 0x2E, 0x00, 0x20, //TELinkDescriptorsTLV
0x00, 0x04, 0x00, 0x08, //LinkLocalRemoteIdentifiersTlv
0x01, 0x11, 0x00, 0x09,
0x01, 0x21, 0x00, 0x09,
0x00, 0x06, 0x00, 0x04, //IPv4InterfaceAddressTlv
0x01, 0x01, 0x01, 0x01,
0x00, 0x08, 0x00, 0x04, //IPv4NeighborAddressTlv
0x01, 0x011, 0x01, 0x10,
0x04, (byte) 0xF3, 0x00, 0x2C, //TENodeAttributesTlv
0x03, (byte) 0xE9, 0x00, 0x04, //OpaqueNodeAttributeTlv
0x01, 0x011, 0x01, 0x10,
0x03, (byte) 0xEF, 0x00, 0x08, //NodeNameTlv
0x08, 0x00, 0x01, 0x09,
0x08, 0x00, 0x01, 0x09,
0x00, 0x6B, 0x00, 0x08, //ISISAreaIdentifierTlv
0x20, 0x01, 0x22, 0x01,
0x20, 0x01, 0x22, 0x01,
0x00, (byte) 0x86, 0x00, 0x04, //IPv4TERouterIdOfLocalNodeTlv
0x00, 0x01, 0x01, 0x02,
0x07, 0x69, 0x00, 0x4C, //TELinkAttributesTlv
0x05, 0x3C, 0x00, 0x04, //IPv4TERouterIdOfRemoteNodeTlv
0x00, 0x07, 0x08, 0x00,
0x00, 0x03, 0x00, 0x04, //AdministrativeGroupTlv
0x00, 0x09, 0x08, 0x00,
0x00, 0x09, 0x00, 0x04, //MaximumLinkBandwidthTlv
0x00, 0x09, 0x00, 0x00,
0x00, 0x0a, 0x00, 0x04, //MaximumReservableLinkBandwidthTlv
0x00, 0x10, 0x00, 0x00,
0x00, 0x0b, 0x00, 0x04, //UnreservedBandwidthTlv
0x00, 0x00, (byte) 0x90, 0x00,
0x34, 0x58, 0x00, 0x04, //TEDefaultMetricTlv
0x00, (byte) 0x99, 0x09, 0x00,
0x00, 0x14, 0x00, 0x02, //LinkProtectionTypeTlv
0x09, 0x00, 0x00, 0x00,
0x04, 0x46, 0x00, 0x01, //MPLSProtocolMaskTlv
(byte) 0x80, 0x00, 0x00, 0x00,
0x04, 0x47, 0x00, 0x03, //IGPMetricTlv
0x09, (byte) 0x89, 0x07, 0x00
};
ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
buffer.writeBytes(teReportMsg);
PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
PcepMessage message = null;
message = reader.readFrom(buffer);
byte[] testReportMsg = {0};
Assert.assertTrue("PcepMessage is not instance of PcTERpt", message instanceof PcepTEReportMsg);
ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
message.writeTo(buf);
int readLen = buf.writerIndex() - 0;
testReportMsg = new byte[readLen];
buf.readBytes(testReportMsg, 0, readLen);
Assert.assertArrayEquals("PcTERpt messages are not equal", teReportMsg, testReportMsg);
}
}
/*
* 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.protocol.PcepNai;
import org.onosproject.pcepio.types.SrEroSubObject;
import com.google.common.testing.EqualsTester;
public class SrEroSubObjectTest {
private final boolean bFFlag = false;
private final boolean bSFlag = false;
private final boolean bCFlag = false;
private final boolean bMFlag = false;
private final byte st = 1;
private final int sID = 1;
private final PcepNai nai = null;
private final SrEroSubObject tlv1 = SrEroSubObject.of(st, bFFlag, bSFlag, bCFlag, bMFlag, sID, nai);
private final boolean bFFlag1 = false;
private final boolean bSFlag1 = false;
private final boolean bCFlag1 = false;
private final boolean bMFlag1 = false;
private final byte st1 = 1;
private final int sID1 = 1;
private final PcepNai nai1 = null;
private final SrEroSubObject tlv2 = SrEroSubObject.of(st1, bFFlag1, bSFlag1, bCFlag1, bMFlag1, sID1, nai1);
private final boolean bFFlag2 = true;
private final boolean bSFlag2 = true;
private final boolean bCFlag2 = true;
private final boolean bMFlag2 = true;
private final byte st2 = 2;
private final int sID2 = 2;
private final PcepNai nai2 = null;
private final SrEroSubObject tlv3 = SrEroSubObject.of(st2, bFFlag2, bSFlag2, bCFlag2, bMFlag2, sID2, nai2);
@Test
public void basics() {
new EqualsTester().addEqualityGroup(tlv1, tlv2).addEqualityGroup(tlv3).testEquals();
}
}
/*
* 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.StatefulIPv4LspIdentidiersTlv;
import com.google.common.testing.EqualsTester;
public class StatefulIPv4LspIdentidiersTlvTest {
private final int ipv4IngressAddress = 1;
private final short lspId = 1;
private final short tunnelId = 1;
private final int extendedTunnelId = 1;
private final int ipv4EgressAddress = 1;
private final StatefulIPv4LspIdentidiersTlv tlv1 = StatefulIPv4LspIdentidiersTlv.of(ipv4IngressAddress, lspId,
tunnelId, extendedTunnelId, ipv4EgressAddress);
private final int ipv4IngressAddress1 = 1;
private final short lspId1 = 1;
private final short tunnelId1 = 1;
private final int extendedTunnelId1 = 1;
private final int ipv4EgressAddress1 = 1;
private final StatefulIPv4LspIdentidiersTlv tlv2 = StatefulIPv4LspIdentidiersTlv.of(ipv4IngressAddress1, lspId1,
tunnelId1, extendedTunnelId1, ipv4EgressAddress1);
private final int ipv4IngressAddress2 = 2;
private final short lspId2 = 2;
private final short tunnelId2 = 2;
private final int extendedTunnelId2 = 2;
private final int ipv4EgressAddress2 = 2;
private final StatefulIPv4LspIdentidiersTlv tlv3 = StatefulIPv4LspIdentidiersTlv.of(ipv4IngressAddress2, lspId2,
tunnelId2, extendedTunnelId2, ipv4EgressAddress2);
@Test
public void basics() {
new EqualsTester().addEqualityGroup(tlv1, tlv2).addEqualityGroup(tlv3).testEquals();
}
}
/*
* 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.StatefulLspErrorCodeTlv;
import com.google.common.testing.EqualsTester;
public class StatefulLspErrorCodeTlvTest {
private final StatefulLspErrorCodeTlv tlv1 = StatefulLspErrorCodeTlv.of(1);
private final StatefulLspErrorCodeTlv tlv2 = StatefulLspErrorCodeTlv.of(1);
private final StatefulLspErrorCodeTlv tlv3 = StatefulLspErrorCodeTlv.of(2);
@Test
public void basics() {
new EqualsTester().addEqualityGroup(tlv1, tlv2).addEqualityGroup(tlv3).testEquals();
}
}
......@@ -25,17 +25,17 @@ import com.google.common.testing.EqualsTester;
*/
public class SymbolicPathNameTlvTest {
byte[] value1 = {0x41 };
Short length1 = new Short((short) 2);
final SymbolicPathNameTlv tlv1 = SymbolicPathNameTlv.of(value1, length1);
private final byte[] value1 = {0x41 };
private final Short length1 = new Short((short) 2);
private final SymbolicPathNameTlv tlv1 = SymbolicPathNameTlv.of(value1, length1);
byte[] value2 = {0x41 };
Short length2 = new Short((short) 2);
final SymbolicPathNameTlv tlv2 = SymbolicPathNameTlv.of(value1, length2);
private final byte[] value2 = {0x41 };
private final Short length2 = new Short((short) 2);
private final SymbolicPathNameTlv tlv2 = SymbolicPathNameTlv.of(value1, length2);
byte[] value3 = {0x41, 0x43 };
Short length3 = new Short((short) 3);
final SymbolicPathNameTlv tlv3 = SymbolicPathNameTlv.of(value3, length3);
private final byte[] value3 = {0x41, 0x43 };
private final Short length3 = new Short((short) 3);
private final SymbolicPathNameTlv tlv3 = SymbolicPathNameTlv.of(value3, length3);
@Test
public void basics() {
......