diff options
Diffstat (limited to 'framework/src/onos/core/api/src/test/java/org/onosproject/net/topology')
7 files changed, 0 insertions, 449 deletions
diff --git a/framework/src/onos/core/api/src/test/java/org/onosproject/net/topology/ClusterIdTest.java b/framework/src/onos/core/api/src/test/java/org/onosproject/net/topology/ClusterIdTest.java deleted file mode 100644 index 1eb6331f..00000000 --- a/framework/src/onos/core/api/src/test/java/org/onosproject/net/topology/ClusterIdTest.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright 2014 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.net.topology; - -import com.google.common.testing.EqualsTester; -import org.junit.Test; - -import static org.junit.Assert.*; -import static org.onosproject.net.topology.ClusterId.clusterId; - -/** - * Test of the cluster ID. - */ -public class ClusterIdTest { - - @Test - public void testEquals() { - new EqualsTester() - .addEqualityGroup(clusterId(1), clusterId(1)) - .addEqualityGroup(clusterId(3), clusterId(3)).testEquals(); - } - - @Test - public void basics() { - assertEquals("incorrect index", 123, clusterId(123).index()); - } - -} diff --git a/framework/src/onos/core/api/src/test/java/org/onosproject/net/topology/DefaultGraphDescriptionTest.java b/framework/src/onos/core/api/src/test/java/org/onosproject/net/topology/DefaultGraphDescriptionTest.java deleted file mode 100644 index f3958491..00000000 --- a/framework/src/onos/core/api/src/test/java/org/onosproject/net/topology/DefaultGraphDescriptionTest.java +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Copyright 2014 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.net.topology; - -import com.google.common.collect.ImmutableSet; - -import org.junit.Test; -import org.onosproject.net.DefaultDevice; -import org.onosproject.net.Device; -import org.onosproject.net.DeviceId; - -import static org.junit.Assert.assertEquals; -import static org.onosproject.net.Device.Type.SWITCH; -import static org.onosproject.net.DeviceId.deviceId; -import static org.onosproject.net.topology.DefaultTopologyEdgeTest.*; - -public class DefaultGraphDescriptionTest { - - static final DefaultTopologyEdge E1 = new DefaultTopologyEdge(V1, V2, L1); - static final DefaultTopologyEdge E2 = new DefaultTopologyEdge(V1, V2, L1); - - private static final DeviceId D3 = deviceId("3"); - - static final Device DEV1 = new DefaultDevice(PID, D1, SWITCH, "", "", "", "", null); - static final Device DEV2 = new DefaultDevice(PID, D2, SWITCH, "", "", "", "", null); - static final Device DEV3 = new DefaultDevice(PID, D3, SWITCH, "", "", "", "", null); - - @Test - public void basics() { - DefaultGraphDescription desc = - new DefaultGraphDescription(4321L, System.currentTimeMillis(), ImmutableSet.of(DEV1, DEV2, DEV3), - ImmutableSet.of(L1, L2)); - assertEquals("incorrect time", 4321L, desc.timestamp()); - assertEquals("incorrect vertex count", 3, desc.vertexes().size()); - assertEquals("incorrect edge count", 2, desc.edges().size()); - } - - @Test - public void missingVertex() { - GraphDescription desc = new DefaultGraphDescription(4321L, System.currentTimeMillis(), - ImmutableSet.of(DEV1, DEV3), - ImmutableSet.of(L1, L2)); - assertEquals("incorrect time", 4321L, desc.timestamp()); - assertEquals("incorrect vertex count", 2, desc.vertexes().size()); - assertEquals("incorrect edge count", 0, desc.edges().size()); - } -} diff --git a/framework/src/onos/core/api/src/test/java/org/onosproject/net/topology/DefaultTopologyClusterTest.java b/framework/src/onos/core/api/src/test/java/org/onosproject/net/topology/DefaultTopologyClusterTest.java deleted file mode 100644 index 06ed8fde..00000000 --- a/framework/src/onos/core/api/src/test/java/org/onosproject/net/topology/DefaultTopologyClusterTest.java +++ /dev/null @@ -1,54 +0,0 @@ -/* - * 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.net.topology; - -import com.google.common.testing.EqualsTester; -import org.junit.Test; - -import static org.junit.Assert.assertEquals; -import static org.onosproject.net.DeviceId.deviceId; -import static org.onosproject.net.topology.ClusterId.clusterId; - -/** - * Test of the default topology cluster implementation. - */ -public class DefaultTopologyClusterTest { - - @Test - public void testEquals() { - new EqualsTester() - .addEqualityGroup(cluster(3, 2, 1, "of:1"), cluster(3, 2, 1, "of:1")) - .addEqualityGroup(cluster(3, 2, 1, "of:2"), cluster(3, 2, 1, "of:2")) - .addEqualityGroup(cluster(0, 2, 1, "of:1"), cluster(0, 2, 1, "of:1")) - .addEqualityGroup(cluster(3, 3, 1, "of:1"), cluster(3, 3, 1, "of:1")) - .testEquals(); - } - - @Test - public void basics() { - TopologyCluster cluster = cluster(6, 5, 4, "of:111"); - assertEquals("incorrect id", clusterId(6), cluster.id()); - assertEquals("incorrect id", 5, cluster.deviceCount()); - assertEquals("incorrect id", 4, cluster.linkCount()); - assertEquals("incorrect id", deviceId("of:111"), cluster.root().deviceId()); - - } - - private TopologyCluster cluster(int id, int dc, int lc, String root) { - return new DefaultTopologyCluster(clusterId(id), dc, lc, - new DefaultTopologyVertex(deviceId(root))); - } -} diff --git a/framework/src/onos/core/api/src/test/java/org/onosproject/net/topology/DefaultTopologyEdgeTest.java b/framework/src/onos/core/api/src/test/java/org/onosproject/net/topology/DefaultTopologyEdgeTest.java deleted file mode 100644 index 830e9b9f..00000000 --- a/framework/src/onos/core/api/src/test/java/org/onosproject/net/topology/DefaultTopologyEdgeTest.java +++ /dev/null @@ -1,70 +0,0 @@ -/* - * Copyright 2014 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.net.topology; - -import com.google.common.testing.EqualsTester; -import org.junit.Test; -import org.onosproject.net.ConnectPoint; -import org.onosproject.net.DefaultLink; -import org.onosproject.net.DeviceId; -import org.onosproject.net.Link; -import org.onosproject.net.PortNumber; -import org.onosproject.net.provider.ProviderId; - -import static org.junit.Assert.assertEquals; -import static org.onosproject.net.DeviceId.deviceId; -import static org.onosproject.net.PortNumber.portNumber; - -/** - * Tests of the topology graph edge. - */ -public class DefaultTopologyEdgeTest { - - static final DeviceId D1 = deviceId("1"); - static final DeviceId D2 = deviceId("2"); - static final PortNumber P1 = portNumber(1); - static final PortNumber P2 = portNumber(2); - - static final ConnectPoint CP1 = new ConnectPoint(D1, P1); - static final ConnectPoint CP2 = new ConnectPoint(D2, P1); - static final ConnectPoint CP3 = new ConnectPoint(D2, P1); - static final ConnectPoint CP4 = new ConnectPoint(D1, P2); - - static final DefaultTopologyVertex V1 = new DefaultTopologyVertex(D1); - static final DefaultTopologyVertex V2 = new DefaultTopologyVertex(D2); - - static final ProviderId PID = new ProviderId("foo", "bar"); - - /** D1:P1 -> D2:P1. */ - static final Link L1 = new DefaultLink(PID, CP1, CP2, Link.Type.INDIRECT); - /** D2:P1 -> D1:P2. */ - static final Link L2 = new DefaultLink(PID, CP3, CP4, Link.Type.INDIRECT); - - @Test - public void basics() { - DefaultTopologyEdge e = new DefaultTopologyEdge(V1, V2, L1); - assertEquals("incorrect src", V1, e.src()); - assertEquals("incorrect dst", V2, e.dst()); - assertEquals("incorrect link", L1, e.link()); - - new EqualsTester() - .addEqualityGroup(new DefaultTopologyEdge(V1, V2, L1), - new DefaultTopologyEdge(V1, V2, L1)) - .addEqualityGroup(new DefaultTopologyEdge(V2, V1, L2), - new DefaultTopologyEdge(V2, V1, L2)) - .testEquals(); - } -} diff --git a/framework/src/onos/core/api/src/test/java/org/onosproject/net/topology/DefaultTopologyVertexTest.java b/framework/src/onos/core/api/src/test/java/org/onosproject/net/topology/DefaultTopologyVertexTest.java deleted file mode 100644 index aa01d261..00000000 --- a/framework/src/onos/core/api/src/test/java/org/onosproject/net/topology/DefaultTopologyVertexTest.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright 2014 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.net.topology; - -import com.google.common.testing.EqualsTester; -import org.junit.Test; -import org.onosproject.net.DeviceId; - -import static org.junit.Assert.*; -import static org.onosproject.net.DeviceId.deviceId; - -/** - * Tests of the topology graph vertex. - */ -public class DefaultTopologyVertexTest { - - private static final DeviceId D1 = deviceId("1"); - private static final DeviceId D2 = deviceId("2"); - - @Test - public void basics() { - DefaultTopologyVertex v = new DefaultTopologyVertex(D1); - assertEquals("incorrect device id", D1, v.deviceId()); - - new EqualsTester() - .addEqualityGroup(new DefaultTopologyVertex(D1), - new DefaultTopologyVertex(D1)) - .addEqualityGroup(new DefaultTopologyVertex(D2), - new DefaultTopologyVertex(D2)).testEquals(); - } -} diff --git a/framework/src/onos/core/api/src/test/java/org/onosproject/net/topology/PathServiceAdapter.java b/framework/src/onos/core/api/src/test/java/org/onosproject/net/topology/PathServiceAdapter.java deleted file mode 100644 index 6a8e586f..00000000 --- a/framework/src/onos/core/api/src/test/java/org/onosproject/net/topology/PathServiceAdapter.java +++ /dev/null @@ -1,62 +0,0 @@ -/* - * 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.net.topology; - -import org.onosproject.net.DisjointPath; -import org.onosproject.net.ElementId; -import org.onosproject.net.Link; -import org.onosproject.net.Path; - -import java.util.Map; -import java.util.Set; - -/** - * Test adapter for path service. - */ -public class PathServiceAdapter implements PathService { - @Override - public Set<Path> getPaths(ElementId src, ElementId dst) { - return null; - } - - @Override - public Set<Path> getPaths(ElementId src, ElementId dst, LinkWeight weight) { - return null; - } - - @Override - public Set<DisjointPath> getDisjointPaths(ElementId src, ElementId dst) { - return null; - } - - @Override - public Set<DisjointPath> getDisjointPaths(ElementId src, ElementId dst, LinkWeight weight) { - return null; - } - - @Override - public Set<DisjointPath> getDisjointPaths(ElementId src, ElementId dst, - Map<Link, Object> riskProfile) { - return null; - } - - @Override - public Set<DisjointPath> getDisjointPaths(ElementId src, ElementId dst, - LinkWeight weight, - Map<Link, Object> riskProfile) { - return null; - } -} diff --git a/framework/src/onos/core/api/src/test/java/org/onosproject/net/topology/TopologyServiceAdapter.java b/framework/src/onos/core/api/src/test/java/org/onosproject/net/topology/TopologyServiceAdapter.java deleted file mode 100644 index 72cc67d7..00000000 --- a/framework/src/onos/core/api/src/test/java/org/onosproject/net/topology/TopologyServiceAdapter.java +++ /dev/null @@ -1,118 +0,0 @@ -/* - * Copyright 2014 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.net.topology; - -import org.onosproject.net.ConnectPoint; -import org.onosproject.net.DeviceId; -import org.onosproject.net.DisjointPath; -import org.onosproject.net.Link; -import org.onosproject.net.Path; - -import java.util.Map; -import java.util.Set; - -/** - * Test adapter for topology service. - */ -public class TopologyServiceAdapter implements TopologyService { - @Override - public Topology currentTopology() { - return null; - } - - @Override - public boolean isLatest(Topology topology) { - return false; - } - - @Override - public TopologyGraph getGraph(Topology topology) { - return null; - } - - @Override - public Set<TopologyCluster> getClusters(Topology topology) { - return null; - } - - @Override - public TopologyCluster getCluster(Topology topology, ClusterId clusterId) { - return null; - } - - @Override - public Set<DeviceId> getClusterDevices(Topology topology, TopologyCluster cluster) { - return null; - } - - @Override - public Set<Link> getClusterLinks(Topology topology, TopologyCluster cluster) { - return null; - } - - @Override - public Set<Path> getPaths(Topology topology, DeviceId src, DeviceId dst) { - return null; - } - - @Override - public Set<Path> getPaths(Topology topology, DeviceId src, DeviceId dst, LinkWeight weight) { - return null; - } - - @Override - public boolean isInfrastructure(Topology topology, ConnectPoint connectPoint) { - return false; - } - - @Override - public boolean isBroadcastPoint(Topology topology, ConnectPoint connectPoint) { - return false; - } - - @Override - public void addListener(TopologyListener listener) { - } - - @Override - public void removeListener(TopologyListener listener) { - } - - @Override - public Set<DisjointPath> getDisjointPaths(Topology topology, DeviceId src, DeviceId dst) { - return null; - } - - @Override - public Set<DisjointPath> getDisjointPaths(Topology topology, DeviceId src, - DeviceId dst, LinkWeight weight) { - return null; - } - - @Override - public Set<DisjointPath> getDisjointPaths(Topology topology, DeviceId src, DeviceId dst, - Map<Link, Object> riskProfile) { - return null; - } - - @Override - public Set<DisjointPath> getDisjointPaths(Topology topology, DeviceId src, - DeviceId dst, LinkWeight weight, - Map<Link, Object> riskProfile) { - return null; - } - -} |