summaryrefslogtreecommitdiffstats
path: root/framework/src/onos/protocols/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/attr
diff options
context:
space:
mode:
Diffstat (limited to 'framework/src/onos/protocols/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/attr')
-rw-r--r--framework/src/onos/protocols/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/attr/BgpAttrNodeFlagBitTlvTest.java50
-rw-r--r--framework/src/onos/protocols/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/attr/BgpAttrRouterIdV6Test.java49
-rw-r--r--framework/src/onos/protocols/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/attr/BgpLinkAttrIgpMetricTest.java43
-rw-r--r--framework/src/onos/protocols/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/attr/BgpLinkAttrMaxLinkBandwidthTest.java43
-rw-r--r--framework/src/onos/protocols/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/attr/BgpLinkAttrMplsProtocolMaskTest.java42
-rw-r--r--framework/src/onos/protocols/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/attr/BgpLinkAttrNameTest.java38
-rw-r--r--framework/src/onos/protocols/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/attr/BgpLinkAttrOpaqLnkAttribTest.java41
-rw-r--r--framework/src/onos/protocols/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/attr/BgpLinkAttrProtectionTypeTest.java56
-rw-r--r--framework/src/onos/protocols/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/attr/BgpLinkAttrTeDefaultMetricTest.java40
-rw-r--r--framework/src/onos/protocols/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/attr/BgpLinkAttrUnRsrvdLinkBandwidthTest.java56
-rw-r--r--framework/src/onos/protocols/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/attr/BgpPrefixAttrIgpFlagsTest.java53
-rw-r--r--framework/src/onos/protocols/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/attr/BgpPrefixAttrMetricTest.java39
-rw-r--r--framework/src/onos/protocols/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/attr/BgpPrefixAttrOpaqueDataTest.java41
-rw-r--r--framework/src/onos/protocols/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/attr/BgpPrefixAttrOspfFwdAddrTest.java51
-rw-r--r--framework/src/onos/protocols/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/attr/BgpPrefixAttrRouteTagTest.java54
15 files changed, 696 insertions, 0 deletions
diff --git a/framework/src/onos/protocols/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/attr/BgpAttrNodeFlagBitTlvTest.java b/framework/src/onos/protocols/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/attr/BgpAttrNodeFlagBitTlvTest.java
new file mode 100644
index 00000000..4efb7f5b
--- /dev/null
+++ b/framework/src/onos/protocols/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/framework/src/onos/protocols/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/attr/BgpAttrRouterIdV6Test.java b/framework/src/onos/protocols/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/attr/BgpAttrRouterIdV6Test.java
new file mode 100644
index 00000000..16ca58ee
--- /dev/null
+++ b/framework/src/onos/protocols/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/framework/src/onos/protocols/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/attr/BgpLinkAttrIgpMetricTest.java b/framework/src/onos/protocols/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/attr/BgpLinkAttrIgpMetricTest.java
new file mode 100644
index 00000000..ef1cfcea
--- /dev/null
+++ b/framework/src/onos/protocols/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/framework/src/onos/protocols/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/attr/BgpLinkAttrMaxLinkBandwidthTest.java b/framework/src/onos/protocols/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/protocols/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/protocols/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/attr/BgpLinkAttrMplsProtocolMaskTest.java b/framework/src/onos/protocols/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/protocols/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/protocols/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/attr/BgpLinkAttrNameTest.java b/framework/src/onos/protocols/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/protocols/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/protocols/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/attr/BgpLinkAttrOpaqLnkAttribTest.java b/framework/src/onos/protocols/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/protocols/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/protocols/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/attr/BgpLinkAttrProtectionTypeTest.java b/framework/src/onos/protocols/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/attr/BgpLinkAttrProtectionTypeTest.java
new file mode 100644
index 00000000..2fb76352
--- /dev/null
+++ b/framework/src/onos/protocols/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/framework/src/onos/protocols/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/attr/BgpLinkAttrTeDefaultMetricTest.java b/framework/src/onos/protocols/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/protocols/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/protocols/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/attr/BgpLinkAttrUnRsrvdLinkBandwidthTest.java b/framework/src/onos/protocols/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/protocols/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/protocols/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/attr/BgpPrefixAttrIgpFlagsTest.java b/framework/src/onos/protocols/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/protocols/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/protocols/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/attr/BgpPrefixAttrMetricTest.java b/framework/src/onos/protocols/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/protocols/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/protocols/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/attr/BgpPrefixAttrOpaqueDataTest.java b/framework/src/onos/protocols/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/protocols/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/protocols/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/attr/BgpPrefixAttrOspfFwdAddrTest.java b/framework/src/onos/protocols/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/attr/BgpPrefixAttrOspfFwdAddrTest.java
new file mode 100644
index 00000000..f6fe39f8
--- /dev/null
+++ b/framework/src/onos/protocols/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();
+ }
+}
diff --git a/framework/src/onos/protocols/bgp/bgpio/src/test/java/org/onosproject/bgpio/types/attr/BgpPrefixAttrRouteTagTest.java b/framework/src/onos/protocols/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/protocols/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