aboutsummaryrefslogtreecommitdiffstats
path: root/framework/src/onos/bgp/bgpio/src/test/java/org
diff options
context:
space:
mode:
Diffstat (limited to 'framework/src/onos/bgp/bgpio/src/test/java/org')
-rw-r--r--framework/src/onos/bgp/bgpio/src/test/java/org/onosproject/bgp/BgpLinkAttrMaxLinkBandwidthTest.java44
-rw-r--r--framework/src/onos/bgp/bgpio/src/test/java/org/onosproject/bgp/BgpLinkAttrTeDefaultMetricTest.java42
-rw-r--r--framework/src/onos/bgp/bgpio/src/test/java/org/onosproject/bgp/BgpPrefixAttrOpaqueDataTest.java42
-rwxr-xr-xframework/src/onos/bgp/bgpio/src/test/java/org/onosproject/bgpio/protocol/BGPKeepaliveMsgTest.java66
-rwxr-xr-xframework/src/onos/bgp/bgpio/src/test/java/org/onosproject/bgpio/protocol/BGPOpenMsgTest.java314
-rw-r--r--framework/src/onos/bgp/bgpio/src/test/java/org/onosproject/bgpio/protocol/BgpNotificationMsgTest.java224
-rw-r--r--framework/src/onos/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/AreaIdTest.java77
-rwxr-xr-xframework/src/onos/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/As4PathTest.java55
-rw-r--r--framework/src/onos/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/AsPathTest.java55
-rw-r--r--framework/src/onos/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/AutonomousSystemTest.java39
-rw-r--r--framework/src/onos/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/BGPLSIdentifierTest.java39
-rw-r--r--framework/src/onos/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/IPReachabilityInformationTest.java40
-rwxr-xr-xframework/src/onos/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/IPv4AddressTest.java40
-rw-r--r--framework/src/onos/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/IPv6AddressTest.java40
-rw-r--r--framework/src/onos/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/IsIsPseudonodeTest.java59
-rw-r--r--framework/src/onos/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/LinkLocalRemoteIdentifiersTest.java39
-rw-r--r--framework/src/onos/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/LocalPrefTest.java40
-rw-r--r--framework/src/onos/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/MedTest.java40
-rwxr-xr-xframework/src/onos/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/NextHopTest.java (renamed from framework/src/onos/bgp/bgpio/src/test/java/org/onosproject/bgp/NextHopTest.java)5
-rw-r--r--framework/src/onos/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/OriginTest.java39
-rw-r--r--framework/src/onos/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/OspfPseudonodeTest.java42
-rw-r--r--framework/src/onos/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/OspfRouteTypeTest.java39
-rw-r--r--framework/src/onos/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/attr/BgpAttrNodeFlagBitTlvTest.java (renamed from framework/src/onos/bgp/bgpio/src/test/java/org/onosproject/bgp/BgpAttrNodeFlagBitTlvTest.java)5
-rw-r--r--framework/src/onos/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/attr/BgpAttrRouterIdV6Test.java (renamed from framework/src/onos/bgp/bgpio/src/test/java/org/onosproject/bgp/BgpAttrRouterIdV6Test.java)5
-rw-r--r--framework/src/onos/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/attr/BgpLinkAttrIgpMetricTest.java (renamed from framework/src/onos/bgp/bgpio/src/test/java/org/onosproject/bgp/BgpLinkAttrIgpMetricTest.java)5
-rw-r--r--framework/src/onos/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/attr/BgpLinkAttrMplsProtocolMaskTest.java42
-rw-r--r--framework/src/onos/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/attr/BgpLinkAttrProtectionTypeTest.java (renamed from framework/src/onos/bgp/bgpio/src/test/java/org/onosproject/bgp/BgpLinkAttrProtectionTypeTest.java)5
-rw-r--r--framework/src/onos/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/attr/BgpPrefixAttrIgpFlagsTest.java53
-rw-r--r--framework/src/onos/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/attr/BgpPrefixAttrMetricTest.java39
-rw-r--r--framework/src/onos/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/attr/BgpPrefixAttrOspfFwdAddrTest.java (renamed from framework/src/onos/bgp/bgpio/src/test/java/org/onosproject/bgp/BgpPrefixAttrOspfFwdAddrTest.java)5
30 files changed, 1561 insertions, 18 deletions
diff --git a/framework/src/onos/bgp/bgpio/src/test/java/org/onosproject/bgp/BgpLinkAttrMaxLinkBandwidthTest.java b/framework/src/onos/bgp/bgpio/src/test/java/org/onosproject/bgp/BgpLinkAttrMaxLinkBandwidthTest.java
new file mode 100644
index 00000000..d4c3b610
--- /dev/null
+++ b/framework/src/onos/bgp/bgpio/src/test/java/org/onosproject/bgp/BgpLinkAttrMaxLinkBandwidthTest.java
@@ -0,0 +1,44 @@
+/*
+ * 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.bgp;
+
+import org.junit.Test;
+import org.onosproject.bgpio.types.attr.BgpLinkAttrMaxLinkBandwidth;
+
+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/bgp/BgpLinkAttrTeDefaultMetricTest.java b/framework/src/onos/bgp/bgpio/src/test/java/org/onosproject/bgp/BgpLinkAttrTeDefaultMetricTest.java
new file mode 100644
index 00000000..b6453c45
--- /dev/null
+++ b/framework/src/onos/bgp/bgpio/src/test/java/org/onosproject/bgp/BgpLinkAttrTeDefaultMetricTest.java
@@ -0,0 +1,42 @@
+/*
+ * 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.bgp;
+
+import org.junit.Test;
+import org.onosproject.bgpio.types.attr.BgpLinkAttrTeDefaultMetric;
+
+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/bgp/BgpPrefixAttrOpaqueDataTest.java b/framework/src/onos/bgp/bgpio/src/test/java/org/onosproject/bgp/BgpPrefixAttrOpaqueDataTest.java
new file mode 100644
index 00000000..7ba6a880
--- /dev/null
+++ b/framework/src/onos/bgp/bgpio/src/test/java/org/onosproject/bgp/BgpPrefixAttrOpaqueDataTest.java
@@ -0,0 +1,42 @@
+/*
+ * 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.bgp;
+
+import org.junit.Test;
+import org.onosproject.bgpio.types.attr.BgpPrefixAttrOpaqueData;
+
+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/protocol/BGPKeepaliveMsgTest.java b/framework/src/onos/bgp/bgpio/src/test/java/org/onosproject/bgpio/protocol/BGPKeepaliveMsgTest.java
new file mode 100755
index 00000000..68ce3070
--- /dev/null
+++ b/framework/src/onos/bgp/bgpio/src/test/java/org/onosproject/bgpio/protocol/BGPKeepaliveMsgTest.java
@@ -0,0 +1,66 @@
+/*
+ * 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.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 static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.Matchers.instanceOf;
+import static org.hamcrest.core.Is.is;
+
+/**
+ * Test case for BGP KEEPALIVE Message.
+ */
+public class BGPKeepaliveMsgTest {
+
+ /**
+ * This test case checks BGP Keepalive message.
+ */
+ @Test
+ public void keepaliveMessageTest1() throws BGPParseException {
+
+ // BGP KEEPALIVE Message
+ byte[] keepaliveMsg = new byte[] {(byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff,
+ (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff,
+ (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff,
+ (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff,
+ 0x00, 0x13, 0x04};
+
+ byte[] testKeepaliveMsg;
+ ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
+ buffer.writeBytes(keepaliveMsg);
+
+ BGPMessageReader<BGPMessage> reader = BGPFactories.getGenericReader();
+ BGPMessage message;
+ BGPHeader bgpHeader = new BGPHeader();
+
+ message = reader.readFrom(buffer, bgpHeader);
+
+ assertThat(message, instanceOf(BGPKeepaliveMsg.class));
+ ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
+ message.writeTo(buf);
+
+ int readLen = buf.writerIndex();
+ testKeepaliveMsg = new byte[readLen];
+ buf.readBytes(testKeepaliveMsg, 0, readLen);
+
+ assertThat(testKeepaliveMsg, is(keepaliveMsg));
+ }
+}
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
new file mode 100755
index 00000000..d5210177
--- /dev/null
+++ b/framework/src/onos/bgp/bgpio/src/test/java/org/onosproject/bgpio/protocol/BGPOpenMsgTest.java
@@ -0,0 +1,314 @@
+/*
+ * 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.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 static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.Matchers.instanceOf;
+import static org.hamcrest.core.Is.is;
+
+/**
+ * Test cases for BGP Open Message.
+ */
+public class BGPOpenMsgTest {
+
+ /**
+ * This test case checks open message without optional parameter.
+ */
+ @Test
+ 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,
+ (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff,
+ (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff,
+ 0x00, 0x1d, 0x01, 0X04, (byte) 0xfe, 0x09, 0x00,
+ (byte) 0xb4, (byte) 0xc0, (byte) 0xa8, 0x00, 0x0f,
+ 0x00};
+
+ byte[] testOpenMsg;
+ ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
+ buffer.writeBytes(openMsg);
+
+ BGPMessageReader<BGPMessage> reader = BGPFactories.getGenericReader();
+ BGPMessage message;
+ BGPHeader bgpHeader = new BGPHeader();
+ message = reader.readFrom(buffer, bgpHeader);
+
+ assertThat(message, instanceOf(BGPOpenMsg.class));
+ ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
+ message.writeTo(buf);
+
+ int readLen = buf.writerIndex();
+ testOpenMsg = new byte[readLen];
+ buf.readBytes(testOpenMsg, 0, readLen);
+
+ assertThat(testOpenMsg, is(openMsg));
+ }
+
+ /**
+ * This test case checks open message with Multiprotocol extension
+ * capability.
+ */
+ @Test
+ public void openMessageTest2() throws BGPParseException {
+
+ // OPEN Message (MultiProtocolExtension-CAPABILITY).
+ byte[] openMsg = new byte[] {(byte) 0xff, (byte) 0xff, (byte) 0xff,
+ (byte) 0xff, (byte) 0xff, (byte) 0xff,
+ (byte) 0xff, (byte) 0xff, (byte) 0xff,
+ (byte) 0xff, (byte) 0xff, (byte) 0xff,
+ (byte) 0xff, (byte) 0xff, (byte) 0xff,
+ (byte) 0xff, 0x00, 0x25,
+ 0x01, //BGP Header
+ 0X04, //Version
+ (byte) 0x00, (byte) 0xc8, // AS Number
+ 0x00, (byte) 0xb4, // Hold time
+ (byte) 0xb6, (byte) 0x02, 0x5d,
+ (byte) 0xc8, // BGP Identifier
+ 0x08, 0x02, 0x06, // Opt Parameter length
+ 0x01, 0x04, 0x00, 0x00, 0x00, (byte) 0xc8}; // Multiprotocol CAPABILITY
+
+ byte[] testOpenMsg;
+ ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
+ buffer.writeBytes(openMsg);
+
+ BGPMessageReader<BGPMessage> reader = BGPFactories.getGenericReader();
+ BGPMessage message;
+ BGPHeader bgpHeader = new BGPHeader();
+
+ message = reader.readFrom(buffer, bgpHeader);
+
+ assertThat(message, instanceOf(BGPOpenMsg.class));
+ ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
+ message.writeTo(buf);
+
+ int readLen = buf.writerIndex();
+ testOpenMsg = new byte[readLen];
+ buf.readBytes(testOpenMsg, 0, readLen);
+
+ assertThat(testOpenMsg, is(openMsg));
+ }
+
+ /**
+ * This test case checks open message with Four-octet AS number
+ * capability.
+ */
+ @Test
+ public void openMessageTest3() throws BGPParseException {
+
+ // OPEN Message (Four-Octet AS number capability).
+ byte[] openMsg = new byte[] {(byte) 0xff, (byte) 0xff, (byte) 0xff,
+ (byte) 0xff, (byte) 0xff, (byte) 0xff,
+ (byte) 0xff, (byte) 0xff, (byte) 0xff,
+ (byte) 0xff, (byte) 0xff, (byte) 0xff,
+ (byte) 0xff, (byte) 0xff, (byte) 0xff,
+ (byte) 0xff, 0x00, 0x25,
+ 0x01, //BGPHeader
+ 0X04, //Version
+ (byte) 0x00, (byte) 0xc8, //AS Number
+ 0x00, (byte) 0xb4, //Hold Time
+ (byte) 0xb6, (byte) 0x02, 0x5d,
+ (byte) 0xc8, //BGP Identifier
+ 0x08, 0x02, 0x06, //Opt Parameter Length
+ 0x41, 0x04, 0x00, 0x01, 0x00, 0x01}; //Four Octet AS Number-CAPABILITY-TLV
+
+ byte[] testOpenMsg;
+ ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
+ buffer.writeBytes(openMsg);
+
+ BGPMessageReader<BGPMessage> reader = BGPFactories.getGenericReader();
+ BGPMessage message;
+ BGPHeader bgpHeader = new BGPHeader();
+
+ message = reader.readFrom(buffer, bgpHeader);
+
+ assertThat(message, instanceOf(BGPOpenMsg.class));
+ ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
+ message.writeTo(buf);
+
+ int readLen = buf.writerIndex();
+ testOpenMsg = new byte[readLen];
+ buf.readBytes(testOpenMsg, 0, readLen);
+
+ assertThat(testOpenMsg, is(openMsg));
+ }
+
+ /**
+ * This test case checks open message with capabilities.
+ */
+ @Test
+ public void openMessageTest4() throws BGPParseException {
+
+ // OPEN Message with capabilities.
+ byte[] openMsg = new byte[] {(byte) 0xff, (byte) 0xff, (byte) 0xff,
+ (byte) 0xff, (byte) 0xff, (byte) 0xff,
+ (byte) 0xff, (byte) 0xff, (byte) 0xff,
+ (byte) 0xff, (byte) 0xff, (byte) 0xff,
+ (byte) 0xff, (byte) 0xff, (byte) 0xff,
+ (byte) 0xff, 0x00, 0x2b,
+ 0x01, //BGPHeader
+ 0X04, //Version
+ (byte) 0x00, (byte) 0xc8, //AS Number
+ 0x00, (byte) 0xb4, //Hold Time
+ (byte) 0xb6, (byte) 0x02, 0x5d, (byte) 0xc8, //BGP Identifier
+ 0x0e, 0x02, 0x0c, //Opt Parameter Length
+ 0x01, 0x04, 0x00, 0x00, 0x00, (byte) 0xc8, // Multiprotocol extension capability
+ 0x41, 0x04, 0x00, 0x01, 0x00, 0x01}; //Four Octet AS Number-CAPABILITY-TLV
+
+ byte[] testOpenMsg;
+ ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
+ buffer.writeBytes(openMsg);
+
+ BGPMessageReader<BGPMessage> reader = BGPFactories.getGenericReader();
+ BGPMessage message;
+ BGPHeader bgpHeader = new BGPHeader();
+
+ message = reader.readFrom(buffer, bgpHeader);
+
+ assertThat(message, instanceOf(BGPOpenMsg.class));
+
+ ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
+ message.writeTo(buf);
+
+ int readLen = buf.writerIndex();
+ testOpenMsg = new byte[readLen];
+ buf.readBytes(testOpenMsg, 0, readLen);
+
+ assertThat(testOpenMsg, is(openMsg));
+ }
+
+ /**
+ * In this test case, Invalid version is given as input and expecting
+ * an exception.
+ */
+ @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,
+ (byte) 0xff, (byte) 0xff, (byte) 0xff,
+ (byte) 0xff, (byte) 0xff, (byte) 0xff,
+ (byte) 0xff, (byte) 0xff, (byte) 0xff,
+ (byte) 0xff, (byte) 0xff, (byte) 0xff,
+ (byte) 0xff, 0x00, 0x1d, 0x01, 0X05,
+ (byte) 0xfe, 0x09, 0x00, (byte) 0xb4,
+ (byte) 0xc0, (byte) 0xa8, 0x00, 0x0f,
+ 0x00};
+
+ ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
+ buffer.writeBytes(openMsg);
+
+ BGPMessageReader<BGPMessage> reader = BGPFactories.getGenericReader();
+ BGPMessage message;
+ BGPHeader bgpHeader = new BGPHeader();
+ message = reader.readFrom(buffer, bgpHeader);
+
+ 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 {
+
+ // OPEN Message with marker set to 0.
+ byte[] openMsg = new byte[] {(byte) 0xff, (byte) 0xff, (byte) 0xff,
+ (byte) 0xff, (byte) 0xff, (byte) 0xff,
+ (byte) 0xff, (byte) 0xff, (byte) 0xff,
+ (byte) 0x00, (byte) 0xff, (byte) 0xff,
+ (byte) 0xff, (byte) 0xff, (byte) 0xff,
+ 0x00, 0x00, 0x1d, 0x01, 0X04,
+ (byte) 0xfe, 0x09, 0x00, (byte) 0xb4,
+ (byte) 0xc0, (byte) 0xa8, 0x00, 0x0f,
+ 0x00};
+
+ ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
+ buffer.writeBytes(openMsg);
+
+ BGPMessageReader<BGPMessage> reader = BGPFactories.getGenericReader();
+ BGPMessage message;
+ BGPHeader bgpHeader = new BGPHeader();
+ message = reader.readFrom(buffer, bgpHeader);
+
+ 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 {
+
+ // OPEN Message with invalid header length.
+ byte[] openMsg = new byte[] {(byte) 0xff, (byte) 0xff, (byte) 0xff,
+ (byte) 0xff, (byte) 0xff, (byte) 0xff,
+ (byte) 0xff, (byte) 0xff, (byte) 0xff,
+ (byte) 0xff, (byte) 0xff, (byte) 0xff,
+ (byte) 0xff, (byte) 0xff, (byte) 0xff,
+ (byte) 0xff, 0x00, 0x1e, 0x01, 0X04,
+ (byte) 0xfe, 0x09, 0x00, (byte) 0xb4,
+ (byte) 0xc0, (byte) 0xa8, 0x00, 0x0f,
+ 0x00};
+
+ ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
+ buffer.writeBytes(openMsg);
+
+ BGPMessageReader<BGPMessage> reader = BGPFactories.getGenericReader();
+ BGPMessage message;
+ BGPHeader bgpHeader = new BGPHeader();
+ message = reader.readFrom(buffer, bgpHeader);
+
+ 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 {
+
+ // OPEN Message with invalid message type.
+ byte[] openMsg = new byte[] {(byte) 0xff, (byte) 0xff, (byte) 0xff,
+ (byte) 0xff, (byte) 0xff, (byte) 0xff,
+ (byte) 0xff, (byte) 0xff, (byte) 0xff,
+ (byte) 0xff, (byte) 0xff, (byte) 0xff,
+ (byte) 0xff, (byte) 0xff, (byte) 0xff,
+ (byte) 0xff, 0x00, 0x1d, 0x05, 0X04,
+ (byte) 0xfe, 0x09, 0x00, (byte) 0xb4,
+ (byte) 0xc0, (byte) 0xa8, 0x00, 0x0f,
+ 0x00};
+
+ ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
+ buffer.writeBytes(openMsg);
+
+ BGPMessageReader<BGPMessage> reader = BGPFactories.getGenericReader();
+ BGPMessage message;
+ BGPHeader bgpHeader = new BGPHeader();
+ message = reader.readFrom(buffer, bgpHeader);
+
+ assertThat(message, instanceOf(BGPOpenMsg.class));
+ }
+}
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
new file mode 100644
index 00000000..78edf133
--- /dev/null
+++ b/framework/src/onos/bgp/bgpio/src/test/java/org/onosproject/bgpio/protocol/BgpNotificationMsgTest.java
@@ -0,0 +1,224 @@
+/*
+ * 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.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 static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.Matchers.instanceOf;
+import static org.hamcrest.core.Is.is;
+
+/**
+ * Test for Notification message.
+ */
+public class BgpNotificationMsgTest {
+
+ /**
+ * Notification message with error code, error subcode and data.
+ *
+ * @throws BGPParseException while decoding and encoding notification message
+ */
+ @Test
+ public void bgpNotificationMessageTest1() throws BGPParseException {
+ byte[] notificationMsg = new byte[] {(byte) 0xff, (byte) 0xff,
+ (byte) 0xff, (byte) 0xff,
+ (byte) 0xff, (byte) 0xff,
+ (byte) 0xff, (byte) 0xff,
+ (byte) 0xff, (byte) 0xff,
+ (byte) 0xff, (byte) 0xff,
+ (byte) 0xff, (byte) 0xff,
+ (byte) 0xff, (byte) 0xff, 0x00,
+ 0x17, 0x03, 0x02, 0x02,
+ (byte) 0xfe, (byte) 0xb0};
+
+ byte[] testNotificationMsg = {0};
+ ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
+ buffer.writeBytes(notificationMsg);
+
+ BGPMessageReader<BGPMessage> reader = BGPFactories.getGenericReader();
+ BGPMessage message = null;
+ BGPHeader bgpHeader = new BGPHeader();
+
+ message = reader.readFrom(buffer, bgpHeader);
+ assertThat(message, instanceOf(BGPNotificationMsg.class));
+
+ ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
+ message.writeTo(buf);
+ testNotificationMsg = buf.array();
+
+ int iReadLen = buf.writerIndex() - 0;
+ testNotificationMsg = new byte[iReadLen];
+ buf.readBytes(testNotificationMsg, 0, iReadLen);
+ assertThat(testNotificationMsg, is(notificationMsg));
+ }
+
+ /**
+ * Notification message without data.
+ *
+ * @throws BGPParseException while decoding and encoding notification message
+ */
+ @Test
+ public void bgpNotificationMessageTest2() throws BGPParseException {
+ byte[] notificationMsg = new byte[] {(byte) 0xff, (byte) 0xff,
+ (byte) 0xff, (byte) 0xff,
+ (byte) 0xff, (byte) 0xff,
+ (byte) 0xff, (byte) 0xff,
+ (byte) 0xff, (byte) 0xff,
+ (byte) 0xff, (byte) 0xff,
+ (byte) 0xff, (byte) 0xff,
+ (byte) 0xff, (byte) 0xff, 0x00,
+ 0x15, 0x03, 0x02, 0x00};
+
+ byte[] testNotificationMsg = {0};
+ ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
+ buffer.writeBytes(notificationMsg);
+
+ BGPMessageReader<BGPMessage> reader = BGPFactories.getGenericReader();
+ BGPMessage message = null;
+ BGPHeader bgpHeader = new BGPHeader();
+
+ message = reader.readFrom(buffer, bgpHeader);
+ assertThat(message, instanceOf(BGPNotificationMsg.class));
+
+ ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
+ message.writeTo(buf);
+ testNotificationMsg = buf.array();
+
+ int iReadLen = buf.writerIndex() - 0;
+ testNotificationMsg = new byte[iReadLen];
+ buf.readBytes(testNotificationMsg, 0, iReadLen);
+ assertThat(testNotificationMsg, is(notificationMsg));
+ }
+
+ //Negative scenarios
+ /**
+ * Notification message with wrong maker value.
+ *
+ * @throws BGPParseException while decoding and encoding notification message
+ */
+ @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,
+ (byte) 0xff, (byte) 0xff,
+ (byte) 0xff, (byte) 0xff,
+ 0x01, (byte) 0xff,
+ (byte) 0xff, (byte) 0xff,
+ (byte) 0xff, (byte) 0xff, 0x00,
+ 0x15, 0x03, 0x02, 0x00};
+
+ byte[] testNotificationMsg = {0};
+ ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
+ buffer.writeBytes(notificationMsg);
+
+ BGPMessageReader<BGPMessage> reader = BGPFactories.getGenericReader();
+ BGPMessage message = null;
+ BGPHeader bgpHeader = new BGPHeader();
+
+ message = reader.readFrom(buffer, bgpHeader);
+ assertThat(message, instanceOf(BGPNotificationMsg.class));
+
+ ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
+ message.writeTo(buf);
+ testNotificationMsg = buf.array();
+
+ int iReadLen = buf.writerIndex() - 0;
+ testNotificationMsg = new byte[iReadLen];
+ buf.readBytes(testNotificationMsg, 0, iReadLen);
+ assertThat(testNotificationMsg, is(notificationMsg));
+ }
+
+ /**
+ * Notification message without error subcode.
+ *
+ * @throws BGPParseException while decoding and encoding notification message
+ */
+ @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,
+ (byte) 0xff, (byte) 0xff,
+ (byte) 0xff, (byte) 0xff,
+ (byte) 0xff, (byte) 0xff,
+ (byte) 0xff, (byte) 0xff,
+ (byte) 0xff, (byte) 0xff, 0x00,
+ 0x14, 0x03, 0x02};
+
+ byte[] testNotificationMsg = {0};
+ ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
+ buffer.writeBytes(notificationMsg);
+
+ BGPMessageReader<BGPMessage> reader = BGPFactories.getGenericReader();
+ BGPMessage message = null;
+ BGPHeader bgpHeader = new BGPHeader();
+
+ message = reader.readFrom(buffer, bgpHeader);
+ assertThat(message, instanceOf(BGPNotificationMsg.class));
+
+ ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
+ message.writeTo(buf);
+ testNotificationMsg = buf.array();
+
+ int iReadLen = buf.writerIndex() - 0;
+ testNotificationMsg = new byte[iReadLen];
+ buf.readBytes(testNotificationMsg, 0, iReadLen);
+ assertThat(testNotificationMsg, is(notificationMsg));
+ }
+
+ /**
+ * Notification message with wrong message length.
+ *
+ * @throws BGPParseException while decoding and encoding notification message
+ */
+ @Test(expected = BGPParseException.class)
+ public void bgpNotificationMessageTest5() throws BGPParseException {
+ byte[] notificationMsg = new byte[] {(byte) 0xff, (byte) 0xff,
+ (byte) 0xff, (byte) 0xff,
+ (byte) 0xff, (byte) 0xff,
+ (byte) 0xff, (byte) 0xff,
+ (byte) 0xff, (byte) 0xff,
+ (byte) 0xff, (byte) 0xff,
+ (byte) 0xff, (byte) 0xff,
+ (byte) 0xff, (byte) 0xff, 0x00,
+ 0x14, 0x03, 0x02, 0x02};
+
+ byte[] testNotificationMsg = {0};
+ ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
+ buffer.writeBytes(notificationMsg);
+
+ BGPMessageReader<BGPMessage> reader = BGPFactories.getGenericReader();
+ BGPMessage message = null;
+ BGPHeader bgpHeader = new BGPHeader();
+
+ message = reader.readFrom(buffer, bgpHeader);
+ assertThat(message, instanceOf(BGPNotificationMsg.class));
+
+ ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
+ message.writeTo(buf);
+ testNotificationMsg = buf.array();
+
+ int iReadLen = buf.writerIndex() - 0;
+ testNotificationMsg = new byte[iReadLen];
+ buf.readBytes(testNotificationMsg, 0, iReadLen);
+ assertThat(testNotificationMsg, is(notificationMsg));
+ }
+}
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
new file mode 100644
index 00000000..6a9e2ec5
--- /dev/null
+++ b/framework/src/onos/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/AreaIdTest.java
@@ -0,0 +1,77 @@
+/*
+ * 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 AreaID Tlv.
+ */
+public class AreaIdTest {
+ private final int value1 = 10;
+ private final int value2 = 20;
+ private final AreaIDTlv tlv1 = AreaIDTlv.of(value1);
+ private final AreaIDTlv sameAsTlv1 = AreaIDTlv.of(value1);
+ private final AreaIDTlv tlv2 = AreaIDTlv.of(value2);
+
+ @Test
+ public void testEquality() {
+ new EqualsTester()
+ .addEqualityGroup(tlv1, sameAsTlv1)
+ .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/As4PathTest.java b/framework/src/onos/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/As4PathTest.java
new file mode 100755
index 00000000..3ea56b64
--- /dev/null
+++ b/framework/src/onos/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/As4PathTest.java
@@ -0,0 +1,55 @@
+/*
+ * 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 java.util.ArrayList;
+import java.util.List;
+
+import org.junit.Test;
+
+import com.google.common.testing.EqualsTester;
+
+/**
+ * Test for As4Path BGP Path Attribute.
+ */
+public class As4PathTest {
+ //Two scenarios as4path set and sequence
+ private final List<Integer> as4pathSet1 = new ArrayList<>();
+ private final List<Integer> as4pathSeq1 = new ArrayList<>();
+ private final List<Integer> as4pathSet2 = new ArrayList<>();
+ private final List<Integer> as4pathSeq2 = new ArrayList<>();
+ private final As4Path attr1 = new As4Path(as4pathSet1, null);
+ private final As4Path sameAsAttr1 = new As4Path(as4pathSet1, null);
+ private final As4Path attr2 = new As4Path(as4pathSet2, null);
+ private final As4Path attr3 = new As4Path(null, as4pathSeq1);
+ private final As4Path sameAsAttr3 = new As4Path(null, as4pathSeq1);
+ private final As4Path attr4 = new As4Path(null, as4pathSeq2);
+
+ @Test
+ public void basics() {
+ as4pathSet1.add(197358);
+ as4pathSet1.add(12883);
+ as4pathSet2.add(2008989);
+ as4pathSeq1.add(3009009);
+ as4pathSeq2.add(409900);
+ new EqualsTester()
+ .addEqualityGroup(attr1, sameAsAttr1)
+ .addEqualityGroup(attr2)
+ .addEqualityGroup(attr3, sameAsAttr3)
+ .addEqualityGroup(attr4)
+ .testEquals();
+ }
+}
diff --git a/framework/src/onos/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/AsPathTest.java b/framework/src/onos/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/AsPathTest.java
new file mode 100644
index 00000000..e56ec5a5
--- /dev/null
+++ b/framework/src/onos/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/AsPathTest.java
@@ -0,0 +1,55 @@
+/*
+ * 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 java.util.ArrayList;
+import java.util.List;
+
+import org.junit.Test;
+
+import com.google.common.testing.EqualsTester;
+
+/**
+ * Test for AsPath BGP Path Attribute.
+ */
+public class AsPathTest {
+ //Two scenarios aspath set and sequence
+ private final List<Short> aspathSet1 = new ArrayList<>();
+ private final List<Short> aspathSet2 = new ArrayList<>();
+ private final List<Short> aspathSeq1 = new ArrayList<>();
+ private final List<Short> aspathSeq2 = new ArrayList<>();
+ private final AsPath attr1 = new AsPath(aspathSet1, null);
+ private final AsPath sameAsAttr1 = new AsPath(aspathSet1, null);
+ private final AsPath attr2 = new AsPath(aspathSet2, null);
+ private final AsPath attr3 = new AsPath(null, aspathSeq1);
+ private final AsPath sameAsAttr3 = new AsPath(null, aspathSeq1);
+ private final AsPath attr4 = new AsPath(null, aspathSeq2);
+
+ @Test
+ public void basics() {
+ aspathSet1.add((short) 100);
+ aspathSet1.add((short) 300);
+ aspathSet2.add((short) 200);
+ aspathSeq2.add((short) 400);
+ aspathSeq1.add((short) 300);
+ new EqualsTester()
+ .addEqualityGroup(attr1, sameAsAttr1)
+ .addEqualityGroup(attr2)
+ .addEqualityGroup(attr3, sameAsAttr3)
+ .addEqualityGroup(attr4)
+ .testEquals();
+ }
+}
diff --git a/framework/src/onos/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/AutonomousSystemTest.java b/framework/src/onos/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/AutonomousSystemTest.java
new file mode 100644
index 00000000..1695583b
--- /dev/null
+++ b/framework/src/onos/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/AutonomousSystemTest.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 AutonomousSystem Tlv.
+ */
+public class AutonomousSystemTest {
+ private final int value1 = 101;
+ private final int value2 = 201;
+ private final AutonomousSystemTlv tlv1 = AutonomousSystemTlv.of(value1);
+ private final AutonomousSystemTlv sameAsTlv1 = AutonomousSystemTlv.of(value1);
+ private final AutonomousSystemTlv tlv2 = AutonomousSystemTlv.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/BGPLSIdentifierTest.java b/framework/src/onos/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/BGPLSIdentifierTest.java
new file mode 100644
index 00000000..f3355d35
--- /dev/null
+++ b/framework/src/onos/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/BGPLSIdentifierTest.java
@@ -0,0 +1,39 @@
+/*
+ * 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.bgpio.types;
+
+import org.junit.Test;
+
+import com.google.common.testing.EqualsTester;
+
+/**
+ * Test for BGPLSIdentifier Tlv.
+ */
+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);
+
+ @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/IPReachabilityInformationTest.java b/framework/src/onos/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/IPReachabilityInformationTest.java
new file mode 100644
index 00000000..7bea518a
--- /dev/null
+++ b/framework/src/onos/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/IPReachabilityInformationTest.java
@@ -0,0 +1,40 @@
+/*
+ * 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.bgpio.types;
+
+import org.junit.Test;
+
+import com.google.common.testing.EqualsTester;
+
+/**
+ * Test for IPReachabilityInformation Tlv.
+ */
+public class IPReachabilityInformationTest {
+ private final byte[] value1 = new byte[] {(byte) 0xc0, (byte) 0xa8, 0x4d, 0x01};
+ private final byte[] value2 = new byte[] {(byte) 0xc0};
+ private final IPReachabilityInformationTlv tlv1 = IPReachabilityInformationTlv.of((byte) 0x17, value1, (short) 4);
+ private final IPReachabilityInformationTlv sameAsTlv1 = IPReachabilityInformationTlv
+ .of((byte) 0x17, value1, (short) 4);
+ private final IPReachabilityInformationTlv tlv2 = IPReachabilityInformationTlv.of((byte) 0x05, value2, (short) 1);
+
+ @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/IPv4AddressTest.java b/framework/src/onos/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/IPv4AddressTest.java
new file mode 100755
index 00000000..fdb71189
--- /dev/null
+++ b/framework/src/onos/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/IPv4AddressTest.java
@@ -0,0 +1,40 @@
+/*
+ * 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.bgpio.types;
+
+import org.junit.Test;
+import org.onlab.packet.Ip4Address;
+
+import com.google.common.testing.EqualsTester;
+
+/**
+ * Test for IPv4Address Tlv.
+ */
+public class IPv4AddressTest {
+ private final Ip4Address value1 = Ip4Address.valueOf("127.0.0.1");
+ private final Ip4Address value2 = Ip4Address.valueOf("127.0.0.1");
+ private final IPv4AddressTlv tlv1 = IPv4AddressTlv.of(value1, (short) 259);
+ private final IPv4AddressTlv sameAsTlv1 = IPv4AddressTlv.of(value1, (short) 259);
+ private final IPv4AddressTlv tlv2 = IPv4AddressTlv.of(value2, (short) 260);
+
+ @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/IPv6AddressTest.java b/framework/src/onos/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/IPv6AddressTest.java
new file mode 100644
index 00000000..781935b4
--- /dev/null
+++ b/framework/src/onos/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/IPv6AddressTest.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;
+
+import org.junit.Test;
+import org.onlab.packet.Ip6Address;
+
+import com.google.common.testing.EqualsTester;
+
+/**
+ * Test for IPv6Address Tlv.
+ */
+public class IPv6AddressTest {
+ private final Ip6Address value1 = Ip6Address.valueOf("2001:db8:0:0:0:0:2:1");
+ private final Ip6Address value2 = Ip6Address.valueOf("2001:db8:0:0:0:0:2:1");
+ private final IPv6AddressTlv tlv1 = IPv6AddressTlv.of(value1, (short) 261);
+ private final IPv6AddressTlv sameAsTlv1 = IPv6AddressTlv.of(value1, (short) 261);
+ private final IPv6AddressTlv tlv2 = IPv6AddressTlv.of(value2, (short) 262);
+
+ @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/IsIsPseudonodeTest.java b/framework/src/onos/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/IsIsPseudonodeTest.java
new file mode 100644
index 00000000..00e85dcf
--- /dev/null
+++ b/framework/src/onos/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/IsIsPseudonodeTest.java
@@ -0,0 +1,59 @@
+/*
+ * 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 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;
+
+/**
+ * Test for IsIsPseudonode Tlv.
+ */
+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);
+
+ @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)
+ .testEquals();
+ }
+}
diff --git a/framework/src/onos/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/LinkLocalRemoteIdentifiersTest.java b/framework/src/onos/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/LinkLocalRemoteIdentifiersTest.java
new file mode 100644
index 00000000..f1510b17
--- /dev/null
+++ b/framework/src/onos/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/LinkLocalRemoteIdentifiersTest.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 LinkLocalRemoteIdentifiers Tlv.
+ */
+public class LinkLocalRemoteIdentifiersTest {
+ private final int value1 = 0x12101010;
+ private final int value2 = 0x12101012;
+ private final LinkLocalRemoteIdentifiersTlv tlv1 = LinkLocalRemoteIdentifiersTlv.of(value1, value2);
+ private final LinkLocalRemoteIdentifiersTlv sameAsTlv1 = LinkLocalRemoteIdentifiersTlv.of(value1, value2);
+ private final LinkLocalRemoteIdentifiersTlv tlv2 = LinkLocalRemoteIdentifiersTlv.of(value2, value1);
+
+ @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/LocalPrefTest.java b/framework/src/onos/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/LocalPrefTest.java
new file mode 100644
index 00000000..02a06e05
--- /dev/null
+++ b/framework/src/onos/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/LocalPrefTest.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;
+
+import org.junit.Test;
+import org.onosproject.bgpio.types.LocalPref;
+
+import com.google.common.testing.EqualsTester;
+
+/**
+ * Test for LocalPref BGP Path Attribute.
+ */
+public class LocalPrefTest {
+ private final int value1 = 800;
+ private final int value2 = 300;
+ private final LocalPref attr1 = new LocalPref(value1);
+ private final LocalPref sameAsAttr1 = new LocalPref(value1);
+ private final LocalPref attr2 = new LocalPref(value2);
+
+ @Test
+ public void testEquality() {
+ 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
new file mode 100644
index 00000000..eafcec74
--- /dev/null
+++ b/framework/src/onos/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/MedTest.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;
+
+import org.junit.Test;
+import org.onosproject.bgpio.types.Med;
+
+import com.google.common.testing.EqualsTester;
+
+/**
+ * Test for MED BGP Path Attribute.
+ */
+public class MedTest {
+ private final int value1 = 800;
+ private final int value2 = 200;
+ private final Med attr1 = new Med(value1);
+ private final Med sameAsAttr1 = new Med(value1);
+ private final Med attr2 = new Med(value2);
+
+ @Test
+ public void testEquality() {
+ new EqualsTester()
+ .addEqualityGroup(attr1, sameAsAttr1)
+ .addEqualityGroup(attr2)
+ .testEquals();
+ }
+}
diff --git a/framework/src/onos/bgp/bgpio/src/test/java/org/onosproject/bgp/NextHopTest.java b/framework/src/onos/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/NextHopTest.java
index 109197bb..799419a1 100755
--- a/framework/src/onos/bgp/bgpio/src/test/java/org/onosproject/bgp/NextHopTest.java
+++ b/framework/src/onos/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/NextHopTest.java
@@ -13,11 +13,10 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.onosproject.bgp;
+package org.onosproject.bgpio.types;
import org.junit.Test;
import org.onlab.packet.Ip4Address;
-import org.onosproject.bgpio.types.NextHop;
import com.google.common.testing.EqualsTester;
@@ -38,4 +37,4 @@ public class NextHopTest {
.addEqualityGroup(attr2)
.testEquals();
}
-} \ No newline at end of file
+}
diff --git a/framework/src/onos/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/OriginTest.java b/framework/src/onos/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/OriginTest.java
new file mode 100644
index 00000000..da7b5570
--- /dev/null
+++ b/framework/src/onos/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/OriginTest.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 Origin BGP Path Attribute.
+ */
+public class OriginTest {
+ private final byte value1 = 0x01;
+ private final byte value2 = 0x02;
+ private final Origin attr1 = new Origin(value1);
+ private final Origin sameAsAttr1 = new Origin(value1);
+ private final Origin attr2 = new Origin(value2);
+
+ @Test
+ public void basics() {
+ new EqualsTester()
+ .addEqualityGroup(attr1, sameAsAttr1)
+ .addEqualityGroup(attr2)
+ .testEquals();
+ }
+}
diff --git a/framework/src/onos/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/OspfPseudonodeTest.java b/framework/src/onos/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/OspfPseudonodeTest.java
new file mode 100644
index 00000000..a8002311
--- /dev/null
+++ b/framework/src/onos/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/OspfPseudonodeTest.java
@@ -0,0 +1,42 @@
+/*
+ * 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 org.onlab.packet.Ip4Address;
+
+import com.google.common.testing.EqualsTester;
+
+/**
+ * Test for OSPFPseudonode Tlv.
+ */
+public class OspfPseudonodeTest {
+ private final int value1 = 0xc3223409;
+ private final int value2 = 0xc3223406;
+ private final Ip4Address drInterface1 = Ip4Address.valueOf(0xaf91e01);
+ private final Ip4Address drInterface2 = Ip4Address.valueOf(0xaf91e02);
+ private final OSPFPseudonode tlv1 = OSPFPseudonode.of(value1, drInterface1);
+ private final OSPFPseudonode sameAsTlv1 = OSPFPseudonode.of(value1, drInterface1);
+ private final OSPFPseudonode tlv2 = OSPFPseudonode.of(value2, drInterface2);
+
+ @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/OspfRouteTypeTest.java b/framework/src/onos/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/OspfRouteTypeTest.java
new file mode 100644
index 00000000..859bdbe5
--- /dev/null
+++ b/framework/src/onos/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/OspfRouteTypeTest.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 OSPFRouteType Tlv.
+ */
+public class OspfRouteTypeTest {
+ private final byte value1 = 5;
+ private final byte value2 = 4;
+ private final OSPFRouteTypeTlv tlv1 = OSPFRouteTypeTlv.of(value1);
+ private final OSPFRouteTypeTlv sameAsTlv1 = OSPFRouteTypeTlv.of(value1);
+ private final OSPFRouteTypeTlv tlv2 = OSPFRouteTypeTlv.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/bgp/BgpAttrNodeFlagBitTlvTest.java b/framework/src/onos/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/attr/BgpAttrNodeFlagBitTlvTest.java
index 5f1411ff..4efb7f5b 100644
--- a/framework/src/onos/bgp/bgpio/src/test/java/org/onosproject/bgp/BgpAttrNodeFlagBitTlvTest.java
+++ b/framework/src/onos/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/attr/BgpAttrNodeFlagBitTlvTest.java
@@ -13,10 +13,9 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.onosproject.bgp;
+package org.onosproject.bgpio.types.attr;
import org.junit.Test;
-import org.onosproject.bgpio.types.attr.BgpAttrNodeFlagBitTlv;
import com.google.common.testing.EqualsTester;
@@ -48,4 +47,4 @@ public class BgpAttrNodeFlagBitTlvTest {
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/bgp/BgpAttrRouterIdV6Test.java b/framework/src/onos/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/attr/BgpAttrRouterIdV6Test.java
index 72ca5dbf..16ca58ee 100644
--- a/framework/src/onos/bgp/bgpio/src/test/java/org/onosproject/bgp/BgpAttrRouterIdV6Test.java
+++ b/framework/src/onos/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/attr/BgpAttrRouterIdV6Test.java
@@ -13,11 +13,10 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.onosproject.bgp;
+package org.onosproject.bgpio.types.attr;
import org.junit.Test;
import org.onlab.packet.Ip6Address;
-import org.onosproject.bgpio.types.attr.BgpAttrRouterIdV6;
import com.google.common.testing.EqualsTester;
@@ -47,4 +46,4 @@ public class BgpAttrRouterIdV6Test {
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/bgp/BgpLinkAttrIgpMetricTest.java b/framework/src/onos/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/attr/BgpLinkAttrIgpMetricTest.java
index 32280a79..ef1cfcea 100644
--- a/framework/src/onos/bgp/bgpio/src/test/java/org/onosproject/bgp/BgpLinkAttrIgpMetricTest.java
+++ b/framework/src/onos/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/attr/BgpLinkAttrIgpMetricTest.java
@@ -13,10 +13,9 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.onosproject.bgp;
+package org.onosproject.bgpio.types.attr;
import org.junit.Test;
-import org.onosproject.bgpio.types.attr.BgpLinkAttrIgpMetric;
import com.google.common.testing.EqualsTester;
@@ -41,4 +40,4 @@ public class BgpLinkAttrIgpMetricTest {
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/BgpLinkAttrMplsProtocolMaskTest.java b/framework/src/onos/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/attr/BgpLinkAttrMplsProtocolMaskTest.java
new file mode 100644
index 00000000..c0d7f986
--- /dev/null
+++ b/framework/src/onos/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/attr/BgpLinkAttrMplsProtocolMaskTest.java
@@ -0,0 +1,42 @@
+/*
+ * 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 MPLS protocol mask attribute.
+ */
+public class BgpLinkAttrMplsProtocolMaskTest {
+ private final boolean val = true;
+ private final boolean val1 = false;
+
+ private final BgpLinkAttrMplsProtocolMask data = BgpLinkAttrMplsProtocolMask
+ .of(val, val);
+ private final BgpLinkAttrMplsProtocolMask sameAsData = BgpLinkAttrMplsProtocolMask
+ .of(val, val);
+ private final BgpLinkAttrMplsProtocolMask diffData = BgpLinkAttrMplsProtocolMask
+ .of(val, val1);
+
+ @Test
+ public void basics() {
+
+ new EqualsTester().addEqualityGroup(data, sameAsData)
+ .addEqualityGroup(diffData).testEquals();
+ }
+}
diff --git a/framework/src/onos/bgp/bgpio/src/test/java/org/onosproject/bgp/BgpLinkAttrProtectionTypeTest.java b/framework/src/onos/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/attr/BgpLinkAttrProtectionTypeTest.java
index 89f97a83..2fb76352 100644
--- a/framework/src/onos/bgp/bgpio/src/test/java/org/onosproject/bgp/BgpLinkAttrProtectionTypeTest.java
+++ b/framework/src/onos/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/attr/BgpLinkAttrProtectionTypeTest.java
@@ -13,10 +13,9 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.onosproject.bgp;
+package org.onosproject.bgpio.types.attr;
import org.junit.Test;
-import org.onosproject.bgpio.types.attr.BgpLinkAttrProtectionType;
import com.google.common.testing.EqualsTester;
@@ -54,4 +53,4 @@ public class BgpLinkAttrProtectionTypeTest {
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/BgpPrefixAttrIgpFlagsTest.java b/framework/src/onos/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/attr/BgpPrefixAttrIgpFlagsTest.java
new file mode 100644
index 00000000..535518f8
--- /dev/null
+++ b/framework/src/onos/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/attr/BgpPrefixAttrIgpFlagsTest.java
@@ -0,0 +1,53 @@
+/*
+ * 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 prefix IGP Flag attribute.
+ */
+public class BgpPrefixAttrIgpFlagsTest {
+
+ private final boolean bisisUpDownBit = true;
+ private final boolean bOspfNoUnicastBit = true;
+ private final boolean bOspfLclAddrBit = true;
+ private final boolean bOspfNSSABit = true;
+
+ private final boolean bisisUpDownBit1 = false;
+ private final boolean bOspfNoUnicastBit1 = false;
+ private final boolean bOspfLclAddrBit1 = false;
+ private final boolean bOspfNSSABit1 = false;
+
+ private final BgpPrefixAttrIgpFlags data = BgpPrefixAttrIgpFlags
+ .of(bisisUpDownBit, bOspfNoUnicastBit, bOspfLclAddrBit,
+ bOspfNSSABit);
+ private final BgpPrefixAttrIgpFlags sameAsData = BgpPrefixAttrIgpFlags
+ .of(bisisUpDownBit, bOspfNoUnicastBit, bOspfLclAddrBit,
+ bOspfNSSABit);
+ private final BgpPrefixAttrIgpFlags diffData = BgpPrefixAttrIgpFlags
+ .of(bisisUpDownBit1, bOspfNoUnicastBit1, bOspfLclAddrBit1,
+ bOspfNSSABit1);
+
+ @Test
+ public void basics() {
+
+ new EqualsTester().addEqualityGroup(data, sameAsData)
+ .addEqualityGroup(diffData).testEquals();
+ }
+}
diff --git a/framework/src/onos/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/attr/BgpPrefixAttrMetricTest.java b/framework/src/onos/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/attr/BgpPrefixAttrMetricTest.java
new file mode 100644
index 00000000..fe6079fd
--- /dev/null
+++ b/framework/src/onos/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/attr/BgpPrefixAttrMetricTest.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.attr;
+
+import org.junit.Test;
+
+import com.google.common.testing.EqualsTester;
+
+/**
+ * Test for BGP prefix metric attribute.
+ */
+public class BgpPrefixAttrMetricTest {
+ private final int val = 1111;
+ private final int val1 = 2222;
+
+ private final BgpPrefixAttrMetric data = BgpPrefixAttrMetric.of(val);
+ private final BgpPrefixAttrMetric sameAsData = BgpPrefixAttrMetric.of(val);
+ private final BgpPrefixAttrMetric diffData = BgpPrefixAttrMetric.of(val1);
+
+ @Test
+ public void basics() {
+
+ new EqualsTester().addEqualityGroup(data, sameAsData)
+ .addEqualityGroup(diffData).testEquals();
+ }
+}
diff --git a/framework/src/onos/bgp/bgpio/src/test/java/org/onosproject/bgp/BgpPrefixAttrOspfFwdAddrTest.java b/framework/src/onos/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/attr/BgpPrefixAttrOspfFwdAddrTest.java
index f736bead..f6fe39f8 100644
--- a/framework/src/onos/bgp/bgpio/src/test/java/org/onosproject/bgp/BgpPrefixAttrOspfFwdAddrTest.java
+++ b/framework/src/onos/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/attr/BgpPrefixAttrOspfFwdAddrTest.java
@@ -13,12 +13,11 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.onosproject.bgp;
+package org.onosproject.bgpio.types.attr;
import org.junit.Test;
import org.onlab.packet.Ip4Address;
import org.onlab.packet.Ip6Address;
-import org.onosproject.bgpio.types.attr.BgpPrefixAttrOspfFwdAddr;
import com.google.common.testing.EqualsTester;
@@ -49,4 +48,4 @@ public class BgpPrefixAttrOspfFwdAddrTest {
new EqualsTester().addEqualityGroup(data, sameAsData)
.addEqualityGroup(diffData).testEquals();
}
-} \ No newline at end of file
+}