diff options
Diffstat (limited to 'framework/src/onos/bgp/bgpio/src/test/java/org/onosproject')
16 files changed, 453 insertions, 167 deletions
diff --git a/framework/src/onos/bgp/bgpio/src/test/java/org/onosproject/bgpio/protocol/BGPKeepaliveMsgTest.java b/framework/src/onos/bgp/bgpio/src/test/java/org/onosproject/bgpio/protocol/BgpKeepaliveMsgTest.java index 68ce3070..682c1bc0 100755 --- a/framework/src/onos/bgp/bgpio/src/test/java/org/onosproject/bgpio/protocol/BGPKeepaliveMsgTest.java +++ b/framework/src/onos/bgp/bgpio/src/test/java/org/onosproject/bgpio/protocol/BgpKeepaliveMsgTest.java @@ -18,8 +18,8 @@ package org.onosproject.bgpio.protocol; import org.jboss.netty.buffer.ChannelBuffer; import org.jboss.netty.buffer.ChannelBuffers; import org.junit.Test; -import org.onosproject.bgpio.exceptions.BGPParseException; -import org.onosproject.bgpio.types.BGPHeader; +import org.onosproject.bgpio.exceptions.BgpParseException; +import org.onosproject.bgpio.types.BgpHeader; import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.Matchers.instanceOf; @@ -28,13 +28,13 @@ import static org.hamcrest.core.Is.is; /** * Test case for BGP KEEPALIVE Message. */ -public class BGPKeepaliveMsgTest { +public class BgpKeepaliveMsgTest { /** * This test case checks BGP Keepalive message. */ @Test - public void keepaliveMessageTest1() throws BGPParseException { + public void keepaliveMessageTest1() throws BgpParseException { // BGP KEEPALIVE Message byte[] keepaliveMsg = new byte[] {(byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, @@ -47,13 +47,13 @@ public class BGPKeepaliveMsgTest { ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); buffer.writeBytes(keepaliveMsg); - BGPMessageReader<BGPMessage> reader = BGPFactories.getGenericReader(); - BGPMessage message; - BGPHeader bgpHeader = new BGPHeader(); + BgpMessageReader<BgpMessage> reader = BgpFactories.getGenericReader(); + BgpMessage message; + BgpHeader bgpHeader = new BgpHeader(); message = reader.readFrom(buffer, bgpHeader); - assertThat(message, instanceOf(BGPKeepaliveMsg.class)); + assertThat(message, instanceOf(BgpKeepaliveMsg.class)); ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); message.writeTo(buf); diff --git a/framework/src/onos/bgp/bgpio/src/test/java/org/onosproject/bgpio/protocol/BgpNotificationMsgTest.java b/framework/src/onos/bgp/bgpio/src/test/java/org/onosproject/bgpio/protocol/BgpNotificationMsgTest.java index 78edf133..6dfa57ee 100644 --- a/framework/src/onos/bgp/bgpio/src/test/java/org/onosproject/bgpio/protocol/BgpNotificationMsgTest.java +++ b/framework/src/onos/bgp/bgpio/src/test/java/org/onosproject/bgpio/protocol/BgpNotificationMsgTest.java @@ -18,8 +18,8 @@ package org.onosproject.bgpio.protocol; import org.jboss.netty.buffer.ChannelBuffer; import org.jboss.netty.buffer.ChannelBuffers; import org.junit.Test; -import org.onosproject.bgpio.exceptions.BGPParseException; -import org.onosproject.bgpio.types.BGPHeader; +import org.onosproject.bgpio.exceptions.BgpParseException; +import org.onosproject.bgpio.types.BgpHeader; import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.Matchers.instanceOf; @@ -33,10 +33,10 @@ public class BgpNotificationMsgTest { /** * Notification message with error code, error subcode and data. * - * @throws BGPParseException while decoding and encoding notification message + * @throws BgpParseException while decoding and encoding notification message */ @Test - public void bgpNotificationMessageTest1() throws BGPParseException { + public void bgpNotificationMessageTest1() throws BgpParseException { byte[] notificationMsg = new byte[] {(byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, @@ -52,12 +52,12 @@ public class BgpNotificationMsgTest { ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); buffer.writeBytes(notificationMsg); - BGPMessageReader<BGPMessage> reader = BGPFactories.getGenericReader(); - BGPMessage message = null; - BGPHeader bgpHeader = new BGPHeader(); + BgpMessageReader<BgpMessage> reader = BgpFactories.getGenericReader(); + BgpMessage message = null; + BgpHeader bgpHeader = new BgpHeader(); message = reader.readFrom(buffer, bgpHeader); - assertThat(message, instanceOf(BGPNotificationMsg.class)); + assertThat(message, instanceOf(BgpNotificationMsg.class)); ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); message.writeTo(buf); @@ -72,10 +72,10 @@ public class BgpNotificationMsgTest { /** * Notification message without data. * - * @throws BGPParseException while decoding and encoding notification message + * @throws BgpParseException while decoding and encoding notification message */ @Test - public void bgpNotificationMessageTest2() throws BGPParseException { + public void bgpNotificationMessageTest2() throws BgpParseException { byte[] notificationMsg = new byte[] {(byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, @@ -90,12 +90,12 @@ public class BgpNotificationMsgTest { ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); buffer.writeBytes(notificationMsg); - BGPMessageReader<BGPMessage> reader = BGPFactories.getGenericReader(); - BGPMessage message = null; - BGPHeader bgpHeader = new BGPHeader(); + BgpMessageReader<BgpMessage> reader = BgpFactories.getGenericReader(); + BgpMessage message = null; + BgpHeader bgpHeader = new BgpHeader(); message = reader.readFrom(buffer, bgpHeader); - assertThat(message, instanceOf(BGPNotificationMsg.class)); + assertThat(message, instanceOf(BgpNotificationMsg.class)); ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); message.writeTo(buf); @@ -111,10 +111,10 @@ public class BgpNotificationMsgTest { /** * Notification message with wrong maker value. * - * @throws BGPParseException while decoding and encoding notification message + * @throws BgpParseException while decoding and encoding notification message */ - @Test(expected = BGPParseException.class) - public void bgpNotificationMessageTest3() throws BGPParseException { + @Test(expected = BgpParseException.class) + public void bgpNotificationMessageTest3() throws BgpParseException { byte[] notificationMsg = new byte[] {(byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, @@ -129,12 +129,12 @@ public class BgpNotificationMsgTest { ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); buffer.writeBytes(notificationMsg); - BGPMessageReader<BGPMessage> reader = BGPFactories.getGenericReader(); - BGPMessage message = null; - BGPHeader bgpHeader = new BGPHeader(); + BgpMessageReader<BgpMessage> reader = BgpFactories.getGenericReader(); + BgpMessage message = null; + BgpHeader bgpHeader = new BgpHeader(); message = reader.readFrom(buffer, bgpHeader); - assertThat(message, instanceOf(BGPNotificationMsg.class)); + assertThat(message, instanceOf(BgpNotificationMsg.class)); ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); message.writeTo(buf); @@ -149,10 +149,10 @@ public class BgpNotificationMsgTest { /** * Notification message without error subcode. * - * @throws BGPParseException while decoding and encoding notification message + * @throws BgpParseException while decoding and encoding notification message */ - @Test(expected = BGPParseException.class) - public void bgpNotificationMessageTest4() throws BGPParseException { + @Test(expected = BgpParseException.class) + public void bgpNotificationMessageTest4() throws BgpParseException { byte[] notificationMsg = new byte[] {(byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, @@ -167,12 +167,12 @@ public class BgpNotificationMsgTest { ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); buffer.writeBytes(notificationMsg); - BGPMessageReader<BGPMessage> reader = BGPFactories.getGenericReader(); - BGPMessage message = null; - BGPHeader bgpHeader = new BGPHeader(); + BgpMessageReader<BgpMessage> reader = BgpFactories.getGenericReader(); + BgpMessage message = null; + BgpHeader bgpHeader = new BgpHeader(); message = reader.readFrom(buffer, bgpHeader); - assertThat(message, instanceOf(BGPNotificationMsg.class)); + assertThat(message, instanceOf(BgpNotificationMsg.class)); ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); message.writeTo(buf); @@ -187,10 +187,10 @@ public class BgpNotificationMsgTest { /** * Notification message with wrong message length. * - * @throws BGPParseException while decoding and encoding notification message + * @throws BgpParseException while decoding and encoding notification message */ - @Test(expected = BGPParseException.class) - public void bgpNotificationMessageTest5() throws BGPParseException { + @Test(expected = BgpParseException.class) + public void bgpNotificationMessageTest5() throws BgpParseException { byte[] notificationMsg = new byte[] {(byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, @@ -205,12 +205,12 @@ public class BgpNotificationMsgTest { ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); buffer.writeBytes(notificationMsg); - BGPMessageReader<BGPMessage> reader = BGPFactories.getGenericReader(); - BGPMessage message = null; - BGPHeader bgpHeader = new BGPHeader(); + BgpMessageReader<BgpMessage> reader = BgpFactories.getGenericReader(); + BgpMessage message = null; + BgpHeader bgpHeader = new BgpHeader(); message = reader.readFrom(buffer, bgpHeader); - assertThat(message, instanceOf(BGPNotificationMsg.class)); + assertThat(message, instanceOf(BgpNotificationMsg.class)); ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); message.writeTo(buf); diff --git a/framework/src/onos/bgp/bgpio/src/test/java/org/onosproject/bgpio/protocol/BGPOpenMsgTest.java b/framework/src/onos/bgp/bgpio/src/test/java/org/onosproject/bgpio/protocol/BgpOpenMsgTest.java index d5210177..1fe4036f 100755 --- a/framework/src/onos/bgp/bgpio/src/test/java/org/onosproject/bgpio/protocol/BGPOpenMsgTest.java +++ b/framework/src/onos/bgp/bgpio/src/test/java/org/onosproject/bgpio/protocol/BgpOpenMsgTest.java @@ -18,8 +18,8 @@ package org.onosproject.bgpio.protocol; import org.jboss.netty.buffer.ChannelBuffer; import org.jboss.netty.buffer.ChannelBuffers; import org.junit.Test; -import org.onosproject.bgpio.exceptions.BGPParseException; -import org.onosproject.bgpio.types.BGPHeader; +import org.onosproject.bgpio.exceptions.BgpParseException; +import org.onosproject.bgpio.types.BgpHeader; import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.Matchers.instanceOf; @@ -28,13 +28,13 @@ import static org.hamcrest.core.Is.is; /** * Test cases for BGP Open Message. */ -public class BGPOpenMsgTest { +public class BgpOpenMsgTest { /** * This test case checks open message without optional parameter. */ @Test - public void openMessageTest1() throws BGPParseException { + public void openMessageTest1() throws BgpParseException { //Open message without optional parameter byte[] openMsg = new byte[] {(byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, @@ -48,12 +48,12 @@ public class BGPOpenMsgTest { ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); buffer.writeBytes(openMsg); - BGPMessageReader<BGPMessage> reader = BGPFactories.getGenericReader(); - BGPMessage message; - BGPHeader bgpHeader = new BGPHeader(); + BgpMessageReader<BgpMessage> reader = BgpFactories.getGenericReader(); + BgpMessage message; + BgpHeader bgpHeader = new BgpHeader(); message = reader.readFrom(buffer, bgpHeader); - assertThat(message, instanceOf(BGPOpenMsg.class)); + assertThat(message, instanceOf(BgpOpenMsg.class)); ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); message.writeTo(buf); @@ -69,7 +69,7 @@ public class BGPOpenMsgTest { * capability. */ @Test - public void openMessageTest2() throws BGPParseException { + public void openMessageTest2() throws BgpParseException { // OPEN Message (MultiProtocolExtension-CAPABILITY). byte[] openMsg = new byte[] {(byte) 0xff, (byte) 0xff, (byte) 0xff, @@ -91,13 +91,13 @@ public class BGPOpenMsgTest { ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); buffer.writeBytes(openMsg); - BGPMessageReader<BGPMessage> reader = BGPFactories.getGenericReader(); - BGPMessage message; - BGPHeader bgpHeader = new BGPHeader(); + BgpMessageReader<BgpMessage> reader = BgpFactories.getGenericReader(); + BgpMessage message; + BgpHeader bgpHeader = new BgpHeader(); message = reader.readFrom(buffer, bgpHeader); - assertThat(message, instanceOf(BGPOpenMsg.class)); + assertThat(message, instanceOf(BgpOpenMsg.class)); ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); message.writeTo(buf); @@ -113,7 +113,7 @@ public class BGPOpenMsgTest { * capability. */ @Test - public void openMessageTest3() throws BGPParseException { + public void openMessageTest3() throws BgpParseException { // OPEN Message (Four-Octet AS number capability). byte[] openMsg = new byte[] {(byte) 0xff, (byte) 0xff, (byte) 0xff, @@ -135,13 +135,13 @@ public class BGPOpenMsgTest { ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); buffer.writeBytes(openMsg); - BGPMessageReader<BGPMessage> reader = BGPFactories.getGenericReader(); - BGPMessage message; - BGPHeader bgpHeader = new BGPHeader(); + BgpMessageReader<BgpMessage> reader = BgpFactories.getGenericReader(); + BgpMessage message; + BgpHeader bgpHeader = new BgpHeader(); message = reader.readFrom(buffer, bgpHeader); - assertThat(message, instanceOf(BGPOpenMsg.class)); + assertThat(message, instanceOf(BgpOpenMsg.class)); ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); message.writeTo(buf); @@ -156,7 +156,7 @@ public class BGPOpenMsgTest { * This test case checks open message with capabilities. */ @Test - public void openMessageTest4() throws BGPParseException { + public void openMessageTest4() throws BgpParseException { // OPEN Message with capabilities. byte[] openMsg = new byte[] {(byte) 0xff, (byte) 0xff, (byte) 0xff, @@ -178,13 +178,13 @@ public class BGPOpenMsgTest { ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); buffer.writeBytes(openMsg); - BGPMessageReader<BGPMessage> reader = BGPFactories.getGenericReader(); - BGPMessage message; - BGPHeader bgpHeader = new BGPHeader(); + BgpMessageReader<BgpMessage> reader = BgpFactories.getGenericReader(); + BgpMessage message; + BgpHeader bgpHeader = new BgpHeader(); message = reader.readFrom(buffer, bgpHeader); - assertThat(message, instanceOf(BGPOpenMsg.class)); + assertThat(message, instanceOf(BgpOpenMsg.class)); ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); message.writeTo(buf); @@ -200,8 +200,8 @@ public class BGPOpenMsgTest { * In this test case, Invalid version is given as input and expecting * an exception. */ - @Test(expected = BGPParseException.class) - public void openMessageTest5() throws BGPParseException { + @Test(expected = BgpParseException.class) + public void openMessageTest5() throws BgpParseException { // OPEN Message with invalid version number. byte[] openMsg = new byte[] {(byte) 0xff, (byte) 0xff, (byte) 0xff, @@ -217,20 +217,20 @@ public class BGPOpenMsgTest { ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); buffer.writeBytes(openMsg); - BGPMessageReader<BGPMessage> reader = BGPFactories.getGenericReader(); - BGPMessage message; - BGPHeader bgpHeader = new BGPHeader(); + BgpMessageReader<BgpMessage> reader = BgpFactories.getGenericReader(); + BgpMessage message; + BgpHeader bgpHeader = new BgpHeader(); message = reader.readFrom(buffer, bgpHeader); - assertThat(message, instanceOf(BGPOpenMsg.class)); + assertThat(message, instanceOf(BgpOpenMsg.class)); } /** * In this test case, Marker is set as 0 in input and expecting * an exception. */ - @Test(expected = BGPParseException.class) - public void openMessageTest6() throws BGPParseException { + @Test(expected = BgpParseException.class) + public void openMessageTest6() throws BgpParseException { // OPEN Message with marker set to 0. byte[] openMsg = new byte[] {(byte) 0xff, (byte) 0xff, (byte) 0xff, @@ -246,20 +246,20 @@ public class BGPOpenMsgTest { ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); buffer.writeBytes(openMsg); - BGPMessageReader<BGPMessage> reader = BGPFactories.getGenericReader(); - BGPMessage message; - BGPHeader bgpHeader = new BGPHeader(); + BgpMessageReader<BgpMessage> reader = BgpFactories.getGenericReader(); + BgpMessage message; + BgpHeader bgpHeader = new BgpHeader(); message = reader.readFrom(buffer, bgpHeader); - assertThat(message, instanceOf(BGPOpenMsg.class)); + assertThat(message, instanceOf(BgpOpenMsg.class)); } /** * In this test case, Invalid message length is given as input and expecting * an exception. */ - @Test(expected = BGPParseException.class) - public void openMessageTest7() throws BGPParseException { + @Test(expected = BgpParseException.class) + public void openMessageTest7() throws BgpParseException { // OPEN Message with invalid header length. byte[] openMsg = new byte[] {(byte) 0xff, (byte) 0xff, (byte) 0xff, @@ -275,20 +275,20 @@ public class BGPOpenMsgTest { ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); buffer.writeBytes(openMsg); - BGPMessageReader<BGPMessage> reader = BGPFactories.getGenericReader(); - BGPMessage message; - BGPHeader bgpHeader = new BGPHeader(); + BgpMessageReader<BgpMessage> reader = BgpFactories.getGenericReader(); + BgpMessage message; + BgpHeader bgpHeader = new BgpHeader(); message = reader.readFrom(buffer, bgpHeader); - assertThat(message, instanceOf(BGPOpenMsg.class)); + assertThat(message, instanceOf(BgpOpenMsg.class)); } /** * In this test case, Invalid message type is given as input and expecting * an exception. */ - @Test(expected = BGPParseException.class) - public void openMessageTest8() throws BGPParseException { + @Test(expected = BgpParseException.class) + public void openMessageTest8() throws BgpParseException { // OPEN Message with invalid message type. byte[] openMsg = new byte[] {(byte) 0xff, (byte) 0xff, (byte) 0xff, @@ -304,11 +304,11 @@ public class BGPOpenMsgTest { ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); buffer.writeBytes(openMsg); - BGPMessageReader<BGPMessage> reader = BGPFactories.getGenericReader(); - BGPMessage message; - BGPHeader bgpHeader = new BGPHeader(); + BgpMessageReader<BgpMessage> reader = BgpFactories.getGenericReader(); + BgpMessage message; + BgpHeader bgpHeader = new BgpHeader(); message = reader.readFrom(buffer, bgpHeader); - assertThat(message, instanceOf(BGPOpenMsg.class)); + assertThat(message, instanceOf(BgpOpenMsg.class)); } } diff --git a/framework/src/onos/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/AreaIdTest.java b/framework/src/onos/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/AreaIdTest.java index 6a9e2ec5..e11564ab 100644 --- a/framework/src/onos/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/AreaIdTest.java +++ b/framework/src/onos/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/AreaIdTest.java @@ -36,42 +36,4 @@ public class AreaIdTest { .addEqualityGroup(tlv2) .testEquals(); } - - /** - * Test for OSPFNonPseudonode Tlv. - */ - public static class OspfNonPseudonodeTest { - private final int value1 = 0x12121212; - private final int value2 = 0x12121211; - private final OSPFNonPseudonode tlv1 = OSPFNonPseudonode.of(value1); - private final OSPFNonPseudonode sameAsTlv1 = OSPFNonPseudonode.of(value1); - private final OSPFNonPseudonode tlv2 = OSPFNonPseudonode.of(value2); - - @Test - public void basics() { - new EqualsTester() - .addEqualityGroup(tlv1, sameAsTlv1) - .addEqualityGroup(tlv2) - .testEquals(); - } - } - - /** - * Test for IsIsNonPseudonode Tlv. - */ - public static class IsIsNonPseudonodeTest { - private final byte[] value1 = new byte[] {0x19, 0x00, (byte) 0x95, 0x01, (byte) 0x90, 0x58}; - private final byte[] value2 = new byte[] {0x19, 0x00, (byte) 0x95, 0x01, (byte) 0x90, 0x59}; - private final IsIsNonPseudonode tlv1 = IsIsNonPseudonode.of(value1); - private final IsIsNonPseudonode sameAsTlv1 = IsIsNonPseudonode.of(value1); - private final IsIsNonPseudonode tlv2 = IsIsNonPseudonode.of(value2); - - @Test - public void basics() { - new EqualsTester() - .addEqualityGroup(tlv1, sameAsTlv1) - .addEqualityGroup(tlv2) - .testEquals(); - } - } } diff --git a/framework/src/onos/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/BGPLSIdentifierTest.java b/framework/src/onos/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/BgpLSIdentifierTest.java index f3355d35..59cf96fa 100644 --- a/framework/src/onos/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/BGPLSIdentifierTest.java +++ b/framework/src/onos/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/BgpLSIdentifierTest.java @@ -22,12 +22,12 @@ import com.google.common.testing.EqualsTester; /** * Test for BGPLSIdentifier Tlv. */ -public class BGPLSIdentifierTest { +public class BgpLSIdentifierTest { private final int value1 = 8738; private final int value2 = 13107; - private final BGPLSIdentifierTlv tlv1 = BGPLSIdentifierTlv.of(value1); - private final BGPLSIdentifierTlv sameAsTlv1 = new BGPLSIdentifierTlv(value1); - private final BGPLSIdentifierTlv tlv2 = new BGPLSIdentifierTlv(value2); + private final BgpLSIdentifierTlv tlv1 = BgpLSIdentifierTlv.of(value1); + private final BgpLSIdentifierTlv sameAsTlv1 = new BgpLSIdentifierTlv(value1); + private final BgpLSIdentifierTlv tlv2 = new BgpLSIdentifierTlv(value2); @Test public void basics() { diff --git a/framework/src/onos/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/IsIsNonPseudonodeTest.java b/framework/src/onos/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/IsIsNonPseudonodeTest.java new file mode 100644 index 00000000..7ce4d5d3 --- /dev/null +++ b/framework/src/onos/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/IsIsNonPseudonodeTest.java @@ -0,0 +1,39 @@ +/* + * 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.bgpio.types; + +import org.junit.Test; + +import com.google.common.testing.EqualsTester; + +/** + * Test for IsIsNonPseudonode Tlv. + */ +public class IsIsNonPseudonodeTest { + private final byte[] value1 = new byte[] {0x19, 0x00, (byte) 0x95, 0x01, (byte) 0x90, 0x58}; + private final byte[] value2 = new byte[] {0x19, 0x00, (byte) 0x95, 0x01, (byte) 0x90, 0x59}; + private final IsIsNonPseudonode tlv1 = IsIsNonPseudonode.of(value1); + private final IsIsNonPseudonode sameAsTlv1 = IsIsNonPseudonode.of(value1); + private final IsIsNonPseudonode tlv2 = IsIsNonPseudonode.of(value2); + + @Test + public void testEquality() { + new EqualsTester() + .addEqualityGroup(tlv1, sameAsTlv1) + .addEqualityGroup(tlv2) + .testEquals(); + } +} diff --git a/framework/src/onos/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/IsIsPseudonodeTest.java b/framework/src/onos/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/IsIsPseudonodeTest.java index 00e85dcf..a2a7c2b5 100644 --- a/framework/src/onos/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/IsIsPseudonodeTest.java +++ b/framework/src/onos/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/IsIsPseudonodeTest.java @@ -15,11 +15,6 @@ */ package org.onosproject.bgpio.types; -import java.util.ArrayList; -import java.util.List; - -import org.jboss.netty.buffer.ChannelBuffer; -import org.jboss.netty.buffer.ChannelBuffers; import org.junit.Test; import com.google.common.testing.EqualsTester; @@ -29,28 +24,13 @@ import com.google.common.testing.EqualsTester; */ public class IsIsPseudonodeTest { private final byte[] value1 = new byte[] {0x01, 0x02, 0x01, 0x02, 0x01, 0x02}; - byte value; - List<Byte> isoNodeID1 = new ArrayList<Byte>(); - ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); private final byte[] value2 = new byte[] {0x01, 0x02, 0x01, 0x02, 0x01, 0x03}; - List<Byte> isoNodeID2 = new ArrayList<Byte>(); - ChannelBuffer buffer1 = ChannelBuffers.dynamicBuffer(); - private final IsIsPseudonode tlv1 = IsIsPseudonode.of(isoNodeID1, (byte) 1); - private final IsIsPseudonode sameAsTlv1 = IsIsPseudonode.of(isoNodeID1, (byte) 1); - private final IsIsPseudonode tlv2 = IsIsPseudonode.of(isoNodeID2, (byte) 1); + private final IsIsPseudonode tlv1 = IsIsPseudonode.of(value1, (byte) 1); + private final IsIsPseudonode sameAsTlv1 = IsIsPseudonode.of(value1, (byte) 1); + private final IsIsPseudonode tlv2 = IsIsPseudonode.of(value2, (byte) 1); @Test public void testEquality() { - buffer.writeBytes(value1); - for (int i = 0; i < 6; i++) { - value = buffer.readByte(); - isoNodeID1.add(value); - } - buffer1.writeBytes(value2); - for (int i = 0; i < 6; i++) { - value = buffer1.readByte(); - isoNodeID1.add(value); - } new EqualsTester() .addEqualityGroup(tlv1, sameAsTlv1) .addEqualityGroup(tlv2) diff --git a/framework/src/onos/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/LocalPrefTest.java b/framework/src/onos/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/LocalPrefTest.java index 02a06e05..1bd34385 100644 --- a/framework/src/onos/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/LocalPrefTest.java +++ b/framework/src/onos/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/LocalPrefTest.java @@ -13,10 +13,9 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.onosproject.bgpio; +package org.onosproject.bgpio.types; import org.junit.Test; -import org.onosproject.bgpio.types.LocalPref; import com.google.common.testing.EqualsTester; @@ -32,9 +31,6 @@ public class LocalPrefTest { @Test public void testEquality() { - new EqualsTester() - .addEqualityGroup(attr1, sameAsAttr1) - .addEqualityGroup(attr2) - .testEquals(); + new EqualsTester().addEqualityGroup(attr1, sameAsAttr1).addEqualityGroup(attr2).testEquals(); } } diff --git a/framework/src/onos/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/MedTest.java b/framework/src/onos/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/MedTest.java index eafcec74..2ee5b33f 100644 --- a/framework/src/onos/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/MedTest.java +++ b/framework/src/onos/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/MedTest.java @@ -13,10 +13,9 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.onosproject.bgpio; +package org.onosproject.bgpio.types; import org.junit.Test; -import org.onosproject.bgpio.types.Med; import com.google.common.testing.EqualsTester; @@ -32,9 +31,6 @@ public class MedTest { @Test public void testEquality() { - new EqualsTester() - .addEqualityGroup(attr1, sameAsAttr1) - .addEqualityGroup(attr2) - .testEquals(); + new EqualsTester().addEqualityGroup(attr1, sameAsAttr1).addEqualityGroup(attr2).testEquals(); } } diff --git a/framework/src/onos/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/attr/BgpLinkAttrMaxLinkBandwidthTest.java b/framework/src/onos/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/attr/BgpLinkAttrMaxLinkBandwidthTest.java new file mode 100644 index 00000000..06fecc92 --- /dev/null +++ b/framework/src/onos/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/attr/BgpLinkAttrMaxLinkBandwidthTest.java @@ -0,0 +1,43 @@ +/* + * 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.bgpio.types.attr; + +import org.junit.Test; + +import com.google.common.testing.EqualsTester; + +/** + * Test for BGP link max bandwidth attribute. + */ +public class BgpLinkAttrMaxLinkBandwidthTest { + private final float val = 0x010203; + private final short valLen = 3; + private final float val1 = 0x01020304; + private final short val1Len = 4; + + private final BgpLinkAttrMaxLinkBandwidth data = BgpLinkAttrMaxLinkBandwidth + .of(val, valLen); + private final BgpLinkAttrMaxLinkBandwidth sameAsData = BgpLinkAttrMaxLinkBandwidth + .of(val, valLen); + private final BgpLinkAttrMaxLinkBandwidth diffData = BgpLinkAttrMaxLinkBandwidth + .of(val1, val1Len); + + @Test + public void basics() { + new EqualsTester().addEqualityGroup(data, sameAsData) + .addEqualityGroup(diffData).testEquals(); + } +}
\ No newline at end of file diff --git a/framework/src/onos/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/attr/BgpLinkAttrNameTest.java b/framework/src/onos/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/attr/BgpLinkAttrNameTest.java new file mode 100644 index 00000000..45048527 --- /dev/null +++ b/framework/src/onos/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/attr/BgpLinkAttrNameTest.java @@ -0,0 +1,38 @@ +/* + * 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.bgpio.types.attr; + +import org.junit.Test; + +import com.google.common.testing.EqualsTester; + +/** + * Test for Link attribute name Tlv. + */ +public class BgpLinkAttrNameTest { + private final byte[] array = new byte[] {0x01, 0x02, 0x03, 0x04}; + private final byte[] array1 = new byte[] {0x01, 0x02, 0x03, 0x01}; + + private final BgpLinkAttrName isisData = BgpLinkAttrName.of(array); + private final BgpLinkAttrName sameAsIsisData = BgpLinkAttrName.of(array); + private final BgpLinkAttrName isisDiff = BgpLinkAttrName.of(array1); + + @Test + public void basics() { + new EqualsTester().addEqualityGroup(isisData, sameAsIsisData) + .addEqualityGroup(isisDiff).testEquals(); + } +}
\ No newline at end of file diff --git a/framework/src/onos/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/attr/BgpLinkAttrOpaqLnkAttribTest.java b/framework/src/onos/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/attr/BgpLinkAttrOpaqLnkAttribTest.java new file mode 100644 index 00000000..71d05f85 --- /dev/null +++ b/framework/src/onos/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/attr/BgpLinkAttrOpaqLnkAttribTest.java @@ -0,0 +1,41 @@ +/* + * 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.bgpio.types.attr; + +import org.junit.Test; + +import com.google.common.testing.EqualsTester; + +/** + * Test for Opaque Link attribute Tlv. + */ +public class BgpLinkAttrOpaqLnkAttribTest { + private final byte[] array = new byte[] {0x01, 0x02, 0x03, 0x04}; + private final byte[] array1 = new byte[] {0x01, 0x02, 0x03, 0x01}; + + private final BgpLinkAttrOpaqLnkAttrib isisData = BgpLinkAttrOpaqLnkAttrib + .of(array); + private final BgpLinkAttrOpaqLnkAttrib sameAsIsisData = BgpLinkAttrOpaqLnkAttrib + .of(array); + private final BgpLinkAttrOpaqLnkAttrib isisDiff = BgpLinkAttrOpaqLnkAttrib + .of(array1); + + @Test + public void basics() { + new EqualsTester().addEqualityGroup(isisData, sameAsIsisData) + .addEqualityGroup(isisDiff).testEquals(); + } +}
\ No newline at end of file diff --git a/framework/src/onos/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/attr/BgpLinkAttrTeDefaultMetricTest.java b/framework/src/onos/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/attr/BgpLinkAttrTeDefaultMetricTest.java new file mode 100644 index 00000000..9f3a7fad --- /dev/null +++ b/framework/src/onos/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/attr/BgpLinkAttrTeDefaultMetricTest.java @@ -0,0 +1,40 @@ +/* + * 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.bgpio.types.attr; + +import org.junit.Test; +import com.google.common.testing.EqualsTester; + +/** + * Test for BGP link TE default metric attribute. + */ +public class BgpLinkAttrTeDefaultMetricTest { + private final int val = 0x010203; + private final int val1 = 0x01020304; + + private final BgpLinkAttrTeDefaultMetric data = BgpLinkAttrTeDefaultMetric + .of(val); + private final BgpLinkAttrTeDefaultMetric sameAsData = BgpLinkAttrTeDefaultMetric + .of(val); + private final BgpLinkAttrTeDefaultMetric diffData = BgpLinkAttrTeDefaultMetric + .of(val1); + + @Test + public void basics() { + new EqualsTester().addEqualityGroup(data, sameAsData) + .addEqualityGroup(diffData).testEquals(); + } +}
\ No newline at end of file diff --git a/framework/src/onos/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/attr/BgpLinkAttrUnRsrvdLinkBandwidthTest.java b/framework/src/onos/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/attr/BgpLinkAttrUnRsrvdLinkBandwidthTest.java new file mode 100644 index 00000000..f1d2a1fa --- /dev/null +++ b/framework/src/onos/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/attr/BgpLinkAttrUnRsrvdLinkBandwidthTest.java @@ -0,0 +1,56 @@ +/* + * 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.bgpio.types.attr; + +import java.util.ArrayList; + +import org.junit.Test; + +import com.google.common.testing.EqualsTester; + +/** + * Test for BGP unreserved bandwidth attribute. + */ +public class BgpLinkAttrUnRsrvdLinkBandwidthTest { + ArrayList<Float> maxUnResBandwidth = new ArrayList<Float>(); + ArrayList<Float> maxUnResBandwidth1 = new ArrayList<Float>(); + short sType = 10; + + private final BgpLinkAttrUnRsrvdLinkBandwidth isisData = BgpLinkAttrUnRsrvdLinkBandwidth + .of(maxUnResBandwidth, sType); + private final BgpLinkAttrUnRsrvdLinkBandwidth sameAsIsisData = BgpLinkAttrUnRsrvdLinkBandwidth + .of(maxUnResBandwidth, sType); + private final BgpLinkAttrUnRsrvdLinkBandwidth isisDiff = BgpLinkAttrUnRsrvdLinkBandwidth + .of(maxUnResBandwidth1, sType); + + @Test + public void basics() { + + maxUnResBandwidth.add(new Float(1)); + maxUnResBandwidth.add(new Float(2)); + maxUnResBandwidth.add(new Float(3)); + maxUnResBandwidth.add(new Float(4)); + + maxUnResBandwidth1.add(new Float(1)); + maxUnResBandwidth1.add(new Float(2)); + maxUnResBandwidth1.add(new Float(3)); + maxUnResBandwidth1.add(new Float(1)); + + new EqualsTester().addEqualityGroup(isisData, sameAsIsisData) + .addEqualityGroup(isisDiff).testEquals(); + + } +}
\ No newline at end of file diff --git a/framework/src/onos/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/attr/BgpPrefixAttrOpaqueDataTest.java b/framework/src/onos/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/attr/BgpPrefixAttrOpaqueDataTest.java new file mode 100644 index 00000000..17dafbb7 --- /dev/null +++ b/framework/src/onos/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/attr/BgpPrefixAttrOpaqueDataTest.java @@ -0,0 +1,41 @@ +/* + * 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.bgpio.types.attr; + +import org.junit.Test; + +import com.google.common.testing.EqualsTester; + +/** + * Test for prefix attribute opaque data Tlv. + */ +public class BgpPrefixAttrOpaqueDataTest { + private final byte[] array = new byte[] {0x01, 0x02, 0x03, 0x04}; + private final byte[] array1 = new byte[] {0x01, 0x02, 0x03, 0x01}; + + private final BgpPrefixAttrOpaqueData isisData = BgpPrefixAttrOpaqueData + .of(array); + private final BgpPrefixAttrOpaqueData sameAsIsisData = BgpPrefixAttrOpaqueData + .of(array); + private final BgpPrefixAttrOpaqueData isisDiff = BgpPrefixAttrOpaqueData + .of(array1); + + @Test + public void basics() { + new EqualsTester().addEqualityGroup(isisData, sameAsIsisData) + .addEqualityGroup(isisDiff).testEquals(); + } +}
\ No newline at end of file diff --git a/framework/src/onos/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/attr/BgpPrefixAttrRouteTagTest.java b/framework/src/onos/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/attr/BgpPrefixAttrRouteTagTest.java new file mode 100644 index 00000000..25ced61f --- /dev/null +++ b/framework/src/onos/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/attr/BgpPrefixAttrRouteTagTest.java @@ -0,0 +1,54 @@ +/* + * 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.bgpio.types.attr; + +import java.util.ArrayList; + +import org.junit.Test; + +import com.google.common.testing.EqualsTester; + +/** + * Test for BGP prefix route tag attribute. + */ +public class BgpPrefixAttrRouteTagTest { + ArrayList<Integer> maxUnResBandwidth = new ArrayList<Integer>(); + ArrayList<Integer> maxUnResBandwidth1 = new ArrayList<Integer>(); + + private final BgpPrefixAttrRouteTag isisData = BgpPrefixAttrRouteTag + .of(maxUnResBandwidth); + private final BgpPrefixAttrRouteTag sameAsIsisData = BgpPrefixAttrRouteTag + .of(maxUnResBandwidth); + private final BgpPrefixAttrRouteTag isisDiff = BgpPrefixAttrRouteTag + .of(maxUnResBandwidth1); + + @Test + public void basics() { + + maxUnResBandwidth.add(new Integer(1)); + maxUnResBandwidth.add(new Integer(2)); + maxUnResBandwidth.add(new Integer(3)); + maxUnResBandwidth.add(new Integer(4)); + + maxUnResBandwidth1.add(new Integer(1)); + maxUnResBandwidth1.add(new Integer(2)); + maxUnResBandwidth1.add(new Integer(3)); + maxUnResBandwidth1.add(new Integer(1)); + + new EqualsTester().addEqualityGroup(isisData, sameAsIsisData) + .addEqualityGroup(isisDiff).testEquals(); + } +}
\ No newline at end of file |