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 479 additions and 127 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();
}
if (message instanceof PcepCloseMsg) {
ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
message.writeTo(buf);
testCloseMsg = buf.array();
message = reader.readFrom(buffer);
Assert.assertTrue("PcepMessage is not instance of PcepCloseMsg", 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,72 +15,46 @@
*/
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();
}
if (message instanceof PcepKeepaliveMsg) {
ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
message.writeTo(buf);
testKeepaliveMsg = buf.array();
message = reader.readFrom(buffer);
Assert.assertTrue("PcepMessage is not instance of PcepKeepaliveMsg", message instanceof PcepKeepaliveMsg);
ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
message.writeTo(buf);
testKeepaliveMsg = buf.array();
int iReadLen = buf.writerIndex() - 0;
testKeepaliveMsg = new byte[iReadLen];
buf.readBytes(testKeepaliveMsg, 0, iReadLen);
int iReadLen = buf.writerIndex() - 0;
testKeepaliveMsg = new byte[iReadLen];
buf.readBytes(testKeepaliveMsg, 0, iReadLen);
if (Arrays.equals(keepaliveMsg, testKeepaliveMsg)) {
Assert.assertArrayEquals(keepaliveMsg, testKeepaliveMsg);
log.debug("keepaliveMsg are equal :" + keepaliveMsg);
} else {
Assert.fail("test case failed");
log.debug("not equal");
}
} else {
Assert.fail("test case failed");
log.debug("not equal");
}
Assert.assertArrayEquals("PcTERpt messages are not equal", keepaliveMsg, testKeepaliveMsg);
}
}
......
/*
* 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 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() {
......