diff --git a/apps/pce/app/src/test/java/org/onosproject/pce/pceservice/PathComputationTest.java b/apps/pce/app/src/test/java/org/onosproject/pce/pceservice/PathComputationTest.java index fd134543c5..2241d6d15e 100644 --- a/apps/pce/app/src/test/java/org/onosproject/pce/pceservice/PathComputationTest.java +++ b/apps/pce/app/src/test/java/org/onosproject/pce/pceservice/PathComputationTest.java @@ -483,7 +483,7 @@ public class PathComputationTest { links.add(link2); assertThat(paths.iterator().next().links(), is(links)); - assertThat(paths.iterator().next().cost(), is((double) 70)); + assertThat(paths.iterator().next().weight(), is(ScalarWeight.toWeight(70.0))); } /** @@ -524,7 +524,7 @@ public class PathComputationTest { links.add(link2); assertThat(paths.iterator().next().links(), is(links)); - assertThat(paths.iterator().next().cost(), is((double) 200)); + assertThat(paths.iterator().next().weight(), is(ScalarWeight.toWeight(200.0))); } /** @@ -561,7 +561,7 @@ public class PathComputationTest { Set paths = computePath(link1, link2, link3, link4, constraints); - assertThat(paths.iterator().next().cost(), is((double) 2)); + assertThat(paths.iterator().next().weight(), is(ScalarWeight.toWeight(2.0))); } /** @@ -597,7 +597,7 @@ public class PathComputationTest { constraints.add(bandwidthConst); Set paths = computePath(link1, link2, link3, link4, constraints); - assertThat(paths.iterator().next().cost(), is((double) 2)); + assertThat(paths.iterator().next().weight(), is(ScalarWeight.toWeight(2.0))); } /** @@ -662,7 +662,7 @@ public class PathComputationTest { constraints.add(costConst); Set paths = computePath(link1, link2, link3, link4, constraints); assertThat(paths.iterator().next().links(), is(links)); - assertThat(paths.iterator().next().cost(), is((double) 70)); + assertThat(paths.iterator().next().weight(), is(ScalarWeight.toWeight(70.0))); } /** @@ -727,7 +727,7 @@ public class PathComputationTest { Set paths = computePath(link1, link2, link3, link4, constraints); assertThat(paths.iterator().next().links(), is(links)); - assertThat(paths.iterator().next().cost(), is((double) 70)); + assertThat(paths.iterator().next().weight(), is(ScalarWeight.toWeight(70.0))); } /** @@ -742,7 +742,7 @@ public class PathComputationTest { List constraints = new LinkedList<>(); Set paths = computePath(link1, link2, link3, link4, constraints); - assertThat(paths.iterator().next().cost(), is((double) 2)); + assertThat(paths.iterator().next().weight(), is(ScalarWeight.toWeight(2.0))); } /** @@ -784,7 +784,7 @@ public class PathComputationTest { links.add(link1); links.add(link2); assertThat(paths.iterator().next().links(), is(links)); - assertThat(paths.iterator().next().cost(), is((double) 70)); + assertThat(paths.iterator().next().weight(), is(ScalarWeight.toWeight(70.0))); } /** @@ -877,7 +877,7 @@ public class PathComputationTest { links.add(link1); links.add(link2); assertThat(paths.iterator().next().links(), is(links)); - assertThat(paths.iterator().next().cost(), is((double) 70)); + assertThat(paths.iterator().next().weight(), is(ScalarWeight.toWeight(70.0))); } /** @@ -964,7 +964,7 @@ public class PathComputationTest { links.add(link1); links.add(link2); assertThat(paths.iterator().next().links(), is(links)); - assertThat(paths.iterator().next().cost(), is((double) 70)); + assertThat(paths.iterator().next().weight(), is(ScalarWeight.toWeight(70.0))); } /** @@ -1050,7 +1050,7 @@ public class PathComputationTest { links.add(link1); links.add(link2); assertThat(paths.iterator().next().links(), is(links)); - assertThat(paths.iterator().next().cost(), is((double) 70)); + assertThat(paths.iterator().next().weight(), is(ScalarWeight.toWeight(70.0))); } /** @@ -1138,7 +1138,7 @@ public class PathComputationTest { links.add(link1); links.add(link2); assertThat(paths.iterator().next().links(), is(links)); - assertThat(paths.iterator().next().cost(), is((double) 70)); + assertThat(paths.iterator().next().weight(), is(ScalarWeight.toWeight(70.0))); } /** @@ -1205,7 +1205,7 @@ public class PathComputationTest { List links = new LinkedList<>(); links.add(link1); links.add(link2); - assertThat(paths.iterator().next().cost(), is((double) 2)); + assertThat(paths.iterator().next().weight(), is(ScalarWeight.toWeight(2.0))); } /** @@ -1221,7 +1221,7 @@ public class PathComputationTest { List constraints = new LinkedList<>(); Set paths = computePath(link1, link2, link3, link4, constraints); - assertThat(paths.iterator().next().cost(), is((double) 2)); + assertThat(paths.iterator().next().weight(), is(ScalarWeight.toWeight(2.0))); } /** @@ -1237,7 +1237,7 @@ public class PathComputationTest { List constraints = null; Set paths = computePath(link1, link2, link3, link4, constraints); - assertThat(paths.iterator().next().cost(), is((double) 2)); + assertThat(paths.iterator().next().weight(), is(ScalarWeight.toWeight(2.0))); } /** @@ -1296,7 +1296,7 @@ public class PathComputationTest { links.add(link4); links.add(link5); assertThat(builder.build().iterator().next().links(), is(links)); - assertThat(builder.build().iterator().next().cost(), is((double) 40)); + assertThat(builder.build().iterator().next().weight(), is(ScalarWeight.toWeight(40.0))); } /** @@ -1353,7 +1353,7 @@ public class PathComputationTest { links.add(link2); assertThat(paths.iterator().next().links(), is(links)); - assertThat(paths.iterator().next().cost(), is((double) 2)); + assertThat(paths.iterator().next().weight(), is(ScalarWeight.toWeight(2.0))); } /** diff --git a/apps/pce/app/src/test/java/org/onosproject/pce/pceservice/PceManagerTest.java b/apps/pce/app/src/test/java/org/onosproject/pce/pceservice/PceManagerTest.java index 95a464e36e..1449eb0efb 100644 --- a/apps/pce/app/src/test/java/org/onosproject/pce/pceservice/PceManagerTest.java +++ b/apps/pce/app/src/test/java/org/onosproject/pce/pceservice/PceManagerTest.java @@ -21,6 +21,7 @@ import org.junit.After; import org.junit.Before; import org.junit.Test; import org.onlab.graph.GraphPathSearch; +import org.onlab.graph.ScalarWeight; import org.onlab.junit.TestUtils; import org.onlab.junit.TestUtils.TestUtilsException; import org.onlab.util.Bandwidth; @@ -1011,10 +1012,10 @@ public class PceManagerTest { } /** - * Tests resilency when L2 link is down. + * Tests resiliency when L2 link is down. */ @Test - public void resilencyTest1() { + public void resiliencyTest1() { build4RouterTopo(true, false, false, false, 10); @@ -1050,14 +1051,14 @@ public class PceManagerTest { //Path is D1-D3-D4 assertThat(pathService.paths().iterator().next().links(), is(links)); - assertThat(pathService.paths().iterator().next().cost(), is((double) 180)); + assertThat(pathService.paths().iterator().next().weight(), is(ScalarWeight.toWeight(180.0))); } /** - * Tests resilency when L2 and L4 link is down. + * Tests resiliency when L2 and L4 link is down. */ @Test - public void resilencyTest2() { + public void resiliencyTest2() { build4RouterTopo(true, false, false, false, 10); List constraints = new LinkedList(); @@ -1093,10 +1094,10 @@ public class PceManagerTest { } /** - * Tests resilency when D2 device is down. + * Tests resiliency when D2 device is down. */ @Test - public void resilencyTest3() { + public void resiliencyTest3() { build4RouterTopo(true, false, false, false, 10); List constraints = new LinkedList(); @@ -1134,14 +1135,14 @@ public class PceManagerTest { Path path = tunnelService.queryAllTunnels().iterator().next().path(); //Path is D1-D3-D4 assertThat(path.links(), is(links)); - assertThat(path.cost(), is((double) 180)); + assertThat(path.weight(), is(ScalarWeight.toWeight(180.0))); } /** - * Tests resilency when ingress device is down. + * Tests resiliency when ingress device is down. */ @Test - public void resilencyTest4() { + public void resiliencyTest4() { build4RouterTopo(true, false, false, false, 10); List constraints = new LinkedList(); @@ -1177,10 +1178,10 @@ public class PceManagerTest { } /** - * Tests resilency when D2 and D3 devices are down. + * Tests resiliency when D2 and D3 devices are down. */ @Test - public void resilencyTest5() { + public void resiliencyTest5() { build4RouterTopo(true, false, false, false, 10); List constraints = new LinkedList(); @@ -1226,10 +1227,10 @@ public class PceManagerTest { } /** - * Tests resilency when egress device is down. + * Tests resiliency when egress device is down. */ @Test - public void resilencyTest6() { + public void resiliencyTest6() { build4RouterTopo(true, false, false, false, 10); List constraints = new LinkedList(); @@ -1268,10 +1269,10 @@ public class PceManagerTest { } /** - * Tests resilency when egress device is down. + * Tests resiliency when egress device is down. */ @Test - public void resilencyTest7() { + public void resiliencyTest7() { build4RouterTopo(true, false, false, false, 10); List constraints = new LinkedList(); @@ -1310,10 +1311,10 @@ public class PceManagerTest { } /** - * Tests resilency when D2 device is suspended. + * Tests resiliency when D2 device is suspended. */ @Test - public void resilencyTest8() { + public void resiliencyTest8() { build4RouterTopo(true, false, false, false, 10); List constraints = new LinkedList(); @@ -1355,14 +1356,14 @@ public class PceManagerTest { //Path is D1-D3-D4 assertThat(path.links(), is(links)); - assertThat(path.cost(), is((double) 180)); + assertThat(path.weight(), is(ScalarWeight.toWeight(180.0))); } /** - * Tests resilency when D2 device availability is changed. + * Tests resiliency when D2 device availability is changed. */ @Test - public void resilencyTest11() { + public void resiliencyTest11() { build4RouterTopo(true, false, false, false, 10); List constraints = new LinkedList(); @@ -1404,14 +1405,14 @@ public class PceManagerTest { //Path is D1-D3-D4 assertThat(path.links(), is(links)); - assertThat(path.cost(), is((double) 180)); + assertThat(path.weight(), is(ScalarWeight.toWeight(180.0))); } /** - * Tests resilency when link2 availability is changed. + * Tests resiliency when link2 availability is changed. */ @Test - public void resilencyTest12() { + public void resiliencyTest12() { build4RouterTopo(true, false, false, false, 10); List constraints = new LinkedList(); diff --git a/core/api/src/test/java/org/onosproject/net/DefaultDisjointPathTest.java b/core/api/src/test/java/org/onosproject/net/DefaultDisjointPathTest.java index 5c30c5718a..abe4627cf8 100644 --- a/core/api/src/test/java/org/onosproject/net/DefaultDisjointPathTest.java +++ b/core/api/src/test/java/org/onosproject/net/DefaultDisjointPathTest.java @@ -84,7 +84,7 @@ public class DefaultDisjointPathTest { assertThat(disjointPath1.primary(), is(path1)); assertThat(disjointPath1.backup(), is(path2)); assertThat(disjointPath1.links(), is(links1)); - assertThat(disjointPath1.cost(), is(1.0)); + assertThat(disjointPath1.weight(), is(ScalarWeight.toWeight(1.0))); } /** diff --git a/core/net/src/test/java/org/onosproject/net/topology/impl/TopologyManagerTest.java b/core/net/src/test/java/org/onosproject/net/topology/impl/TopologyManagerTest.java index 35160585ed..fe1e73b06b 100644 --- a/core/net/src/test/java/org/onosproject/net/topology/impl/TopologyManagerTest.java +++ b/core/net/src/test/java/org/onosproject/net/topology/impl/TopologyManagerTest.java @@ -18,6 +18,7 @@ package org.onosproject.net.topology.impl; import org.junit.After; import org.junit.Before; import org.junit.Test; +import org.onlab.graph.ScalarWeight; import org.onosproject.event.Event; import org.onosproject.common.event.impl.TestEventDispatcher; import org.onosproject.net.ConnectPoint; @@ -168,7 +169,7 @@ public class TopologyManagerTest { assertEquals("wrong path count", 2, paths.size()); Path path = paths.iterator().next(); assertEquals("wrong path length", 2, path.links().size()); - assertEquals("wrong path cost", 2, path.cost(), 0.01); + assertEquals("wrong path cost", ScalarWeight.toWeight(2), path.weight()); } @Test @@ -181,7 +182,7 @@ public class TopologyManagerTest { assertEquals("wrong path count", 2, paths.size()); Path path = paths.iterator().next(); assertEquals("wrong path length", 2, path.links().size()); - assertEquals("wrong path cost", 6.6, path.cost(), 0.01); + assertEquals("wrong path cost", ScalarWeight.toWeight(6.6), path.weight()); } protected void validateEvents(Enum... types) { diff --git a/incubator/net/src/test/java/org/onosproject/incubator/net/virtual/impl/VirtualNetworkPathManagerTest.java b/incubator/net/src/test/java/org/onosproject/incubator/net/virtual/impl/VirtualNetworkPathManagerTest.java index cf4910652f..fee06a4bba 100644 --- a/incubator/net/src/test/java/org/onosproject/incubator/net/virtual/impl/VirtualNetworkPathManagerTest.java +++ b/incubator/net/src/test/java/org/onosproject/incubator/net/virtual/impl/VirtualNetworkPathManagerTest.java @@ -19,6 +19,7 @@ package org.onosproject.incubator.net.virtual.impl; import org.junit.After; import org.junit.Before; import org.junit.Test; +import org.onlab.graph.ScalarWeight; import org.onlab.junit.TestUtils; import org.onlab.osgi.TestServiceDirectory; import org.onosproject.common.event.impl.TestEventDispatcher; @@ -233,7 +234,7 @@ public class VirtualNetworkPathManagerTest extends TestDeviceParams { assertEquals("incorrect length", length, path.links().size()); assertEquals("incorrect source", src, path.src().elementId()); assertEquals("incorrect destination", dst, path.dst().elementId()); - assertEquals("incorrect cost", cost, path.cost(), 0); + assertEquals("incorrect cost", ScalarWeight.toWeight(cost), path.weight()); } } } diff --git a/incubator/net/src/test/java/org/onosproject/incubator/net/virtual/impl/VirtualNetworkTopologyManagerTest.java b/incubator/net/src/test/java/org/onosproject/incubator/net/virtual/impl/VirtualNetworkTopologyManagerTest.java index ed51f943a5..3d74d4b740 100644 --- a/incubator/net/src/test/java/org/onosproject/incubator/net/virtual/impl/VirtualNetworkTopologyManagerTest.java +++ b/incubator/net/src/test/java/org/onosproject/incubator/net/virtual/impl/VirtualNetworkTopologyManagerTest.java @@ -19,6 +19,7 @@ package org.onosproject.incubator.net.virtual.impl; import org.junit.After; import org.junit.Before; import org.junit.Test; +import org.onlab.graph.ScalarWeight; import org.onlab.junit.TestUtils; import org.onlab.osgi.TestServiceDirectory; import org.onosproject.common.event.impl.TestEventDispatcher; @@ -420,7 +421,7 @@ public class VirtualNetworkTopologyManagerTest extends TestDeviceParams { assertEquals("The paths size did not match.", 1, paths1.size()); Path path = paths1.iterator().next(); assertEquals("wrong path length", 1, path.links().size()); - assertEquals("wrong path cost", 1.0, path.cost(), 0.01); + assertEquals("wrong path cost", ScalarWeight.toWeight(1.0), path.weight()); } /**