Move unit tests to a directory structure that follows the classes under test
Change-Id: Ibfa840e4aab4100125b4ead0f864f5ad1bea18b6
diff --git a/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/attr/BgpAttrNodeFlagBitTlvTest.java b/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/attr/BgpAttrNodeFlagBitTlvTest.java
new file mode 100644
index 0000000..4efb7f5
--- /dev/null
+++ b/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/attr/BgpAttrNodeFlagBitTlvTest.java
@@ -0,0 +1,50 @@
+/*
+ * 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 attribute node flag.
+ */
+public class BgpAttrNodeFlagBitTlvTest {
+
+ private final boolean bOverloadBit = true;
+ private final boolean bAttachedBit = true;
+ private final boolean bExternalBit = true;
+ private final boolean bABRBit = true;
+
+ private final boolean bOverloadBit1 = false;
+ private final boolean bAttachedBit1 = false;
+ private final boolean bExternalBit1 = false;
+ private final boolean bABRBit1 = false;
+
+ private final BgpAttrNodeFlagBitTlv data = BgpAttrNodeFlagBitTlv
+ .of(bOverloadBit, bAttachedBit, bExternalBit, bABRBit);
+ private final BgpAttrNodeFlagBitTlv sameAsData = BgpAttrNodeFlagBitTlv
+ .of(bOverloadBit, bAttachedBit, bExternalBit, bABRBit);
+ private final BgpAttrNodeFlagBitTlv diffData = BgpAttrNodeFlagBitTlv
+ .of(bOverloadBit1, bAttachedBit1, bExternalBit1, bABRBit1);
+
+ @Test
+ public void basics() {
+
+ new EqualsTester().addEqualityGroup(data, sameAsData)
+ .addEqualityGroup(diffData).testEquals();
+ }
+}
diff --git a/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/attr/BgpAttrRouterIdV6Test.java b/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/attr/BgpAttrRouterIdV6Test.java
new file mode 100644
index 0000000..16ca58e
--- /dev/null
+++ b/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/attr/BgpAttrRouterIdV6Test.java
@@ -0,0 +1,49 @@
+/*
+ * 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 org.onlab.packet.Ip6Address;
+
+import com.google.common.testing.EqualsTester;
+
+/**
+ * Test for BGP attribute node router ID.
+ */
+public class BgpAttrRouterIdV6Test {
+
+ private final short sType = 1;
+ private final Ip6Address ip6RouterId = Ip6Address
+ .valueOf("2001:0db8:0a0b:12f0:0000:0000:0000:0001");
+
+ private final short sType1 = 2;
+ private final Ip6Address ip6RouterId1 = Ip6Address
+ .valueOf("2004:0db8:0a0b:12f0:0000:0000:0000:0004");
+
+ private final BgpAttrRouterIdV6 data = BgpAttrRouterIdV6.of(ip6RouterId,
+ sType);
+ private final BgpAttrRouterIdV6 sameAsData = BgpAttrRouterIdV6
+ .of(ip6RouterId, sType);
+ private final BgpAttrRouterIdV6 diffData = BgpAttrRouterIdV6
+ .of(ip6RouterId1, sType1);
+
+ @Test
+ public void basics() {
+
+ new EqualsTester().addEqualityGroup(data, sameAsData)
+ .addEqualityGroup(diffData).testEquals();
+ }
+}
diff --git a/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/attr/BgpLinkAttrIgpMetricTest.java b/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/attr/BgpLinkAttrIgpMetricTest.java
new file mode 100644
index 0000000..ef1cfce
--- /dev/null
+++ b/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/attr/BgpLinkAttrIgpMetricTest.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 IGP metric attribute.
+ */
+public class BgpLinkAttrIgpMetricTest {
+ private final int val = 0x010203;
+ private final int valLen = 3;
+ private final int val1 = 0x01020304;
+ private final int val1Len = 4;
+
+ private final BgpLinkAttrIgpMetric data = BgpLinkAttrIgpMetric.of(val,
+ valLen);
+ private final BgpLinkAttrIgpMetric sameAsData = BgpLinkAttrIgpMetric
+ .of(val, valLen);
+ private final BgpLinkAttrIgpMetric diffData = BgpLinkAttrIgpMetric
+ .of(val1, val1Len);
+
+ @Test
+ public void basics() {
+ new EqualsTester().addEqualityGroup(data, sameAsData)
+ .addEqualityGroup(diffData).testEquals();
+ }
+}
diff --git a/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/attr/BgpLinkAttrMplsProtocolMaskTest.java b/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/attr/BgpLinkAttrMplsProtocolMaskTest.java
new file mode 100644
index 0000000..c0d7f98
--- /dev/null
+++ b/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/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/attr/BgpLinkAttrProtectionTypeTest.java b/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/attr/BgpLinkAttrProtectionTypeTest.java
new file mode 100644
index 0000000..2fb7635
--- /dev/null
+++ b/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/attr/BgpLinkAttrProtectionTypeTest.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 org.junit.Test;
+
+import com.google.common.testing.EqualsTester;
+
+/**
+ * Test for MPLS protocol mask attribute.
+ */
+public class BgpLinkAttrProtectionTypeTest {
+ boolean bExtraTraffic = true;
+ boolean bUnprotected = true;
+ boolean bShared = true;
+ boolean bDedOneIstoOne = true;
+ boolean bDedOnePlusOne = true;
+ boolean bEnhanced = true;
+
+ boolean bExtraTraffic1 = false;
+ boolean bUnprotected1 = false;
+ boolean bShared1 = false;
+ boolean bDedOneIstoOne1 = false;
+ boolean bDedOnePlusOne1 = false;
+ boolean bEnhanced1 = false;
+
+ private final BgpLinkAttrProtectionType data = BgpLinkAttrProtectionType
+ .of(bExtraTraffic, bUnprotected, bShared, bDedOneIstoOne,
+ bDedOnePlusOne, bEnhanced);
+ private final BgpLinkAttrProtectionType sameAsData = BgpLinkAttrProtectionType
+ .of(bExtraTraffic, bUnprotected, bShared, bDedOneIstoOne,
+ bDedOnePlusOne, bEnhanced);
+ private final BgpLinkAttrProtectionType diffData = BgpLinkAttrProtectionType
+ .of(bExtraTraffic1, bUnprotected1, bShared1, bDedOneIstoOne1,
+ bDedOnePlusOne1, bEnhanced1);
+
+ @Test
+ public void basics() {
+
+ new EqualsTester().addEqualityGroup(data, sameAsData)
+ .addEqualityGroup(diffData).testEquals();
+ }
+}
diff --git a/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/attr/BgpPrefixAttrIgpFlagsTest.java b/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/attr/BgpPrefixAttrIgpFlagsTest.java
new file mode 100644
index 0000000..535518f
--- /dev/null
+++ b/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/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/attr/BgpPrefixAttrMetricTest.java b/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/attr/BgpPrefixAttrMetricTest.java
new file mode 100644
index 0000000..fe6079f
--- /dev/null
+++ b/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/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/attr/BgpPrefixAttrOspfFwdAddrTest.java b/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/attr/BgpPrefixAttrOspfFwdAddrTest.java
new file mode 100644
index 0000000..f6fe39f
--- /dev/null
+++ b/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/attr/BgpPrefixAttrOspfFwdAddrTest.java
@@ -0,0 +1,51 @@
+/*
+ * 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 org.onlab.packet.Ip4Address;
+import org.onlab.packet.Ip6Address;
+
+import com.google.common.testing.EqualsTester;
+
+/**
+ * Test for BGP prefix metric attribute.
+ */
+public class BgpPrefixAttrOspfFwdAddrTest {
+
+ private final short lsAttrLength = 4;
+ private final Ip4Address ip4RouterId = Ip4Address.valueOf("192.168.1.1");
+ private final Ip6Address ip6RouterId = Ip6Address
+ .valueOf("2001:0db8:0a0b:12f0:0000:0000:0000:0001");
+
+ private final short lsAttrLength1 = 16;
+ private final Ip4Address ip4RouterId1 = Ip4Address.valueOf("192.168.1.2");
+ private final Ip6Address ip6RouterId1 = Ip6Address
+ .valueOf("1002:0db8:0a0b:12f0:0000:0000:0000:0002");
+
+ private final BgpPrefixAttrOspfFwdAddr data = BgpPrefixAttrOspfFwdAddr
+ .of(lsAttrLength, ip4RouterId, ip6RouterId);
+ private final BgpPrefixAttrOspfFwdAddr sameAsData = BgpPrefixAttrOspfFwdAddr
+ .of(lsAttrLength, ip4RouterId, ip6RouterId);
+ private final BgpPrefixAttrOspfFwdAddr diffData = BgpPrefixAttrOspfFwdAddr
+ .of(lsAttrLength1, ip4RouterId1, ip6RouterId1);
+
+ @Test
+ public void basics() {
+ new EqualsTester().addEqualityGroup(data, sameAsData)
+ .addEqualityGroup(diffData).testEquals();
+ }
+}