diff options
author | CNlucius <lukai1@huawei.com> | 2016-09-13 11:40:12 +0800 |
---|---|---|
committer | CNlucius <lukai1@huawei.com> | 2016-09-13 11:41:53 +0800 |
commit | b731e2f1dd0972409b136aebc7b463dd72c9cfad (patch) | |
tree | 5107d7d80c19ad8076c2c97c2b5ef8d1cf3ab903 /framework/src/onos/apps/vtn/vtnrsc/src/test/java/org/onosproject/vtnrsc | |
parent | ee93993458266114c29271a481ef9ce7ce621b2a (diff) |
ONOSFW-171
O/S-SFC-ONOS scenario documentation
Change-Id: I51ae1cf736ea24ab6680f8edca1b2bf5dd598365
Signed-off-by: CNlucius <lukai1@huawei.com>
Diffstat (limited to 'framework/src/onos/apps/vtn/vtnrsc/src/test/java/org/onosproject/vtnrsc')
35 files changed, 0 insertions, 3235 deletions
diff --git a/framework/src/onos/apps/vtn/vtnrsc/src/test/java/org/onosproject/vtnrsc/AllowedAddressPairTest.java b/framework/src/onos/apps/vtn/vtnrsc/src/test/java/org/onosproject/vtnrsc/AllowedAddressPairTest.java deleted file mode 100644 index 05152359..00000000 --- a/framework/src/onos/apps/vtn/vtnrsc/src/test/java/org/onosproject/vtnrsc/AllowedAddressPairTest.java +++ /dev/null @@ -1,75 +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.vtnrsc; - -import org.junit.Test; -import org.onlab.packet.IpAddress; -import org.onlab.packet.MacAddress; - -import com.google.common.testing.EqualsTester; - -import static org.hamcrest.MatcherAssert.assertThat; -import static org.hamcrest.Matchers.is; -import static org.hamcrest.Matchers.notNullValue; -import static org.onlab.junit.ImmutableClassChecker.assertThatClassIsImmutable; - -/** - * Unit tests for AllowedAddressPair class. - */ -public class AllowedAddressPairTest { - - final IpAddress ip1 = IpAddress.valueOf("192.168.0.1"); - final IpAddress ip2 = IpAddress.valueOf("192.168.0.2"); - final MacAddress mac1 = MacAddress.valueOf("fa:16:3e:76:83:88"); - final MacAddress mac2 = MacAddress.valueOf("aa:16:3e:76:83:88"); - - /** - * Checks that the AllowedAddressPair class is immutable. - */ - @Test - public void testImmutability() { - assertThatClassIsImmutable(AllowedAddressPair.class); - } - - /** - * Checks the operation of equals(). - */ - @Test - public void testEquals() { - AllowedAddressPair p1 = AllowedAddressPair - .allowedAddressPair(ip1, mac1); - AllowedAddressPair p2 = AllowedAddressPair - .allowedAddressPair(ip1, mac1); - AllowedAddressPair p3 = AllowedAddressPair - .allowedAddressPair(ip2, mac2); - new EqualsTester().addEqualityGroup(p1, p2).addEqualityGroup(p3) - .testEquals(); - } - - /** - * Checks the construction of a AllowedAddressPair object. - */ - @Test - public void testConstruction() { - AllowedAddressPair allowedAddressPair = AllowedAddressPair - .allowedAddressPair(ip1, mac1); - assertThat(ip1, is(notNullValue())); - assertThat(ip1, is(allowedAddressPair.ip())); - assertThat(mac1, is(notNullValue())); - assertThat(mac1, is(allowedAddressPair.mac())); - } -} diff --git a/framework/src/onos/apps/vtn/vtnrsc/src/test/java/org/onosproject/vtnrsc/DefaultAllocationPoolTest.java b/framework/src/onos/apps/vtn/vtnrsc/src/test/java/org/onosproject/vtnrsc/DefaultAllocationPoolTest.java deleted file mode 100644 index 9e7d3c1c..00000000 --- a/framework/src/onos/apps/vtn/vtnrsc/src/test/java/org/onosproject/vtnrsc/DefaultAllocationPoolTest.java +++ /dev/null @@ -1,66 +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.vtnrsc; - -import org.junit.Test; -import org.onlab.packet.IpAddress; - -import com.google.common.testing.EqualsTester; - -import static org.hamcrest.MatcherAssert.assertThat; -import static org.hamcrest.Matchers.is; -import static org.onlab.junit.ImmutableClassChecker.assertThatClassIsImmutable; - -/** - * Unit tests for DefaultAllocationPool class. - */ -public class DefaultAllocationPoolTest { - - final IpAddress startIP1 = IpAddress.valueOf("192.168.1.1"); - final IpAddress startIP2 = IpAddress.valueOf("192.168.1.2"); - final IpAddress endIP1 = IpAddress.valueOf("192.168.1.1"); - final IpAddress endIP2 = IpAddress.valueOf("192.168.1.2"); - - /** - * Checks that the DefaultAllocationPool class is immutable. - */ - @Test - public void testImmutability() { - assertThatClassIsImmutable(DefaultAllocationPool.class); - } - - /** - * Checks the operation of equals() methods. - */ - @Test - public void testEquals() { - AllocationPool pool1 = new DefaultAllocationPool(startIP1, endIP1); - AllocationPool pool2 = new DefaultAllocationPool(startIP1, endIP1); - AllocationPool pool3 = new DefaultAllocationPool(startIP2, endIP2); - new EqualsTester().addEqualityGroup(pool1, pool2) - .addEqualityGroup(pool3).testEquals(); - } - - /** - * Checks the construction of a DefaultAllocationPool object. - */ - @Test - public void testConstruction() { - final AllocationPool apool = new DefaultAllocationPool(startIP1, endIP1); - assertThat(startIP1, is(apool.startIp())); - assertThat(endIP1, is(apool.endIp())); - } -} diff --git a/framework/src/onos/apps/vtn/vtnrsc/src/test/java/org/onosproject/vtnrsc/DefaultFlowClassifierTest.java b/framework/src/onos/apps/vtn/vtnrsc/src/test/java/org/onosproject/vtnrsc/DefaultFlowClassifierTest.java deleted file mode 100644 index 7032c216..00000000 --- a/framework/src/onos/apps/vtn/vtnrsc/src/test/java/org/onosproject/vtnrsc/DefaultFlowClassifierTest.java +++ /dev/null @@ -1,143 +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.vtnrsc; - -import org.junit.Test; -import org.onlab.packet.IpPrefix; - -import com.google.common.testing.EqualsTester; - -import static org.hamcrest.MatcherAssert.assertThat; -import static org.hamcrest.Matchers.is; -import static org.onlab.junit.ImmutableClassChecker.assertThatClassIsImmutable; - -/** - * Unit tests for DefaultFlowClassifier class. - */ -public class DefaultFlowClassifierTest { - /** - * Checks that the DefaultFlowClassifier class is immutable. - */ - @Test - public void testImmutability() { - assertThatClassIsImmutable(DefaultFlowClassifier.class); - } - - /** - * Checks the operation of equals() methods. - */ - @Test - public void testEquals() { - // Create same two flow classifier objects. - final String name = "FlowClassifier1"; - final String description = "FlowClassifier1"; - final String ethType = "IPv4"; - final String protocol = "tcp"; - final int minSrcPortRange = 5; - final int maxSrcPortRange = 10; - final int minDstPortRange = 5; - final int maxDstPortRange = 10; - final FlowClassifierId flowClassifierId = FlowClassifierId.of("78dcd363-fc23-aeb6-f44b-56dc5e2fb3ae"); - final TenantId tenantId = TenantId.tenantId("1"); - final IpPrefix srcIpPrefix = IpPrefix.valueOf("0.0.0.0/0"); - final IpPrefix dstIpPrefix = IpPrefix.valueOf("10.10.10.10/0"); - final VirtualPortId virtualSrcPort = VirtualPortId.portId("1"); - final VirtualPortId virtualDstPort = VirtualPortId.portId("2"); - - DefaultFlowClassifier.Builder flowClassifierBuilder = new DefaultFlowClassifier.Builder(); - final FlowClassifier flowClassifier1 = flowClassifierBuilder.setFlowClassifierId(flowClassifierId) - .setTenantId(tenantId).setName(name).setDescription(description).setEtherType(ethType) - .setProtocol(protocol).setMinSrcPortRange(minSrcPortRange).setMaxSrcPortRange(maxSrcPortRange) - .setMinDstPortRange(minDstPortRange).setMaxDstPortRange(maxDstPortRange).setSrcIpPrefix(srcIpPrefix) - .setDstIpPrefix(dstIpPrefix).setSrcPort(virtualSrcPort).setDstPort(virtualDstPort).build(); - - flowClassifierBuilder = new DefaultFlowClassifier.Builder(); - final FlowClassifier sameAsFlowClassifier1 = flowClassifierBuilder.setFlowClassifierId(flowClassifierId) - .setTenantId(tenantId).setName(name).setDescription(description).setEtherType(ethType) - .setProtocol(protocol).setMinSrcPortRange(minSrcPortRange).setMaxSrcPortRange(maxSrcPortRange) - .setMinDstPortRange(minDstPortRange).setMaxDstPortRange(maxDstPortRange).setSrcIpPrefix(srcIpPrefix) - .setDstIpPrefix(dstIpPrefix).setSrcPort(virtualSrcPort).setDstPort(virtualDstPort).build(); - - // Create different classifier object. - final String name2 = "FlowClassifier2"; - final String description2 = "FlowClassifier2"; - final String ethType2 = "IPv6"; - final String protocol2 = "udp"; - final int minSrcPortRange2 = 5; - final int maxSrcPortRange2 = 10; - final int minDstPortRange2 = 5; - final int maxDstPortRange2 = 10; - final FlowClassifierId flowClassifierId2 = FlowClassifierId.of("78dcd363-fc23-aeb6-f44b-56dc5e2fb3ae"); - final TenantId tenantId2 = TenantId.tenantId("2"); - final IpPrefix srcIpPrefix2 = IpPrefix.valueOf("0.0.0.0/0"); - final IpPrefix dstIpPrefix2 = IpPrefix.valueOf("10.10.10.10/0"); - final VirtualPortId virtualSrcPort2 = VirtualPortId.portId("3"); - final VirtualPortId virtualDstPort2 = VirtualPortId.portId("4"); - - DefaultFlowClassifier.Builder flowClassifierBuilder3 = new DefaultFlowClassifier.Builder(); - final FlowClassifier flowClassifier2 = flowClassifierBuilder3.setFlowClassifierId(flowClassifierId2) - .setTenantId(tenantId2).setName(name2).setDescription(description2).setEtherType(ethType2) - .setProtocol(protocol2).setMinSrcPortRange(minSrcPortRange2).setMaxSrcPortRange(maxSrcPortRange2) - .setMinDstPortRange(minDstPortRange2).setMaxDstPortRange(maxDstPortRange2).setSrcIpPrefix(srcIpPrefix2) - .setDstIpPrefix(dstIpPrefix2).setSrcPort(virtualSrcPort2).setDstPort(virtualDstPort2).build(); - - new EqualsTester().addEqualityGroup(flowClassifier1, sameAsFlowClassifier1).addEqualityGroup(flowClassifier2) - .testEquals(); - } - - /** - * Checks the construction of a DefaultFlowClassifier object. - */ - @Test - public void testConstruction() { - final String name = "FlowClassifier"; - final String description = "FlowClassifier"; - final String ethType = "IPv4"; - final String protocol = "tcp"; - final int minSrcPortRange = 5; - final int maxSrcPortRange = 10; - final int minDstPortRange = 5; - final int maxDstPortRange = 10; - final FlowClassifierId flowClassifierId = FlowClassifierId.of("78dcd363-fc23-aeb6-f44b-56dc5e2fb3ae"); - final TenantId tenantId = TenantId.tenantId("1"); - final IpPrefix srcIpPrefix = IpPrefix.valueOf("0.0.0.0/0"); - final IpPrefix dstIpPrefix = IpPrefix.valueOf("10.10.10.10/0"); - final VirtualPortId virtualSrcPort = VirtualPortId.portId("1"); - final VirtualPortId virtualDstPort = VirtualPortId.portId("2"); - - DefaultFlowClassifier.Builder flowClassifierBuilder = new DefaultFlowClassifier.Builder(); - final FlowClassifier flowClassifier = flowClassifierBuilder.setFlowClassifierId(flowClassifierId) - .setTenantId(tenantId).setName(name).setDescription(description).setEtherType(ethType) - .setProtocol(protocol).setMinSrcPortRange(minSrcPortRange).setMaxSrcPortRange(maxSrcPortRange) - .setMinDstPortRange(minDstPortRange).setMaxDstPortRange(maxDstPortRange).setSrcIpPrefix(srcIpPrefix) - .setDstIpPrefix(dstIpPrefix).setSrcPort(virtualSrcPort).setDstPort(virtualDstPort).build(); - - assertThat(flowClassifierId, is(flowClassifier.flowClassifierId())); - assertThat(tenantId, is(flowClassifier.tenantId())); - assertThat(name, is(flowClassifier.name())); - assertThat(description, is(flowClassifier.description())); - assertThat(ethType, is(flowClassifier.etherType())); - assertThat(protocol, is(flowClassifier.protocol())); - assertThat(minSrcPortRange, is(flowClassifier.minSrcPortRange())); - assertThat(maxSrcPortRange, is(flowClassifier.maxSrcPortRange())); - assertThat(minDstPortRange, is(flowClassifier.minDstPortRange())); - assertThat(maxDstPortRange, is(flowClassifier.maxDstPortRange())); - assertThat(srcIpPrefix, is(flowClassifier.srcIpPrefix())); - assertThat(dstIpPrefix, is(flowClassifier.dstIpPrefix())); - assertThat(virtualSrcPort, is(flowClassifier.srcPort())); - assertThat(virtualDstPort, is(flowClassifier.dstPort())); - } -} diff --git a/framework/src/onos/apps/vtn/vtnrsc/src/test/java/org/onosproject/vtnrsc/DefaultHostRouteTest.java b/framework/src/onos/apps/vtn/vtnrsc/src/test/java/org/onosproject/vtnrsc/DefaultHostRouteTest.java deleted file mode 100644 index 53ead67f..00000000 --- a/framework/src/onos/apps/vtn/vtnrsc/src/test/java/org/onosproject/vtnrsc/DefaultHostRouteTest.java +++ /dev/null @@ -1,66 +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.vtnrsc; - -import org.junit.Test; -import org.onlab.packet.IpAddress; -import org.onlab.packet.IpPrefix; - -import com.google.common.testing.EqualsTester; - -import static org.hamcrest.MatcherAssert.assertThat; -import static org.hamcrest.Matchers.is; -import static org.onlab.junit.ImmutableClassChecker.assertThatClassIsImmutable; - -/** - * Unit tests for DefaultHostRoute class. - */ -public class DefaultHostRouteTest { - final IpAddress nexthop1 = IpAddress.valueOf("192.168.1.1"); - final IpAddress nexthop2 = IpAddress.valueOf("192.168.1.2"); - final IpPrefix destination1 = IpPrefix.valueOf("1.1.1.1/1"); - final IpPrefix destination2 = IpPrefix.valueOf("1.1.1.1/2"); - - /** - * Checks that the DefaultHostRoute class is immutable. - */ - @Test - public void testImmutability() { - assertThatClassIsImmutable(DefaultHostRoute.class); - } - - /** - * Checks the operation of equals() methods. - */ - @Test - public void testEquals() { - HostRoute route1 = new DefaultHostRoute(nexthop1, destination1); - HostRoute route2 = new DefaultHostRoute(nexthop1, destination1); - HostRoute route3 = new DefaultHostRoute(nexthop2, destination2); - new EqualsTester().addEqualityGroup(route1, route2) - .addEqualityGroup(route3).testEquals(); - } - - /** - * Checks the construction of a DefaultHostRoute object. - */ - @Test - public void testConstruction() { - final HostRoute host = new DefaultHostRoute(nexthop1, destination1); - assertThat(nexthop1, is(host.nexthop())); - assertThat(destination1, is(host.destination())); - } -} diff --git a/framework/src/onos/apps/vtn/vtnrsc/src/test/java/org/onosproject/vtnrsc/DefaultNeutronNetworkTest.java b/framework/src/onos/apps/vtn/vtnrsc/src/test/java/org/onosproject/vtnrsc/DefaultNeutronNetworkTest.java deleted file mode 100644 index 7f186a1d..00000000 --- a/framework/src/onos/apps/vtn/vtnrsc/src/test/java/org/onosproject/vtnrsc/DefaultNeutronNetworkTest.java +++ /dev/null @@ -1,77 +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.vtnrsc; - -import org.junit.Test; - -import com.google.common.testing.EqualsTester; - -import static org.onlab.junit.ImmutableClassChecker.assertThatClassIsImmutable; - -/** - * Unit tests for DefaultNeutronNetwork class. - */ -public class DefaultNeutronNetworkTest { - - private String networkIdStr1 = "123"; - private String networkIdStr2 = "234"; - private String physicalNetworkStr = "1234"; - private String tenantIdStr = "345"; - private String segmentationIdStr = "1"; - private String name = "456"; - - /** - * Checks that the DefaultNeutronNetwork class is immutable. - */ - @Test - public void testImmutability() { - assertThatClassIsImmutable(DefaultTenantNetwork.class); - } - - /** - * Checks the operation of equals() methods. - */ - @Test - public void testEquality() { - TenantNetworkId networkid1 = TenantNetworkId.networkId(networkIdStr1); - TenantNetworkId networkid2 = TenantNetworkId.networkId(networkIdStr2); - PhysicalNetwork physicalNetwork = PhysicalNetwork - .physicalNetwork(physicalNetworkStr); - TenantId tenantId = TenantId.tenantId(tenantIdStr); - SegmentationId segmentationID = SegmentationId - .segmentationId(segmentationIdStr); - TenantNetwork p1 = new DefaultTenantNetwork(networkid1, name, false, - TenantNetwork.State.ACTIVE, - false, tenantId, false, - TenantNetwork.Type.LOCAL, - physicalNetwork, - segmentationID); - TenantNetwork p2 = new DefaultTenantNetwork(networkid1, name, false, - TenantNetwork.State.ACTIVE, - false, tenantId, false, - TenantNetwork.Type.LOCAL, - physicalNetwork, - segmentationID); - TenantNetwork p3 = new DefaultTenantNetwork(networkid2, name, false, - TenantNetwork.State.ACTIVE, - false, tenantId, false, - TenantNetwork.Type.LOCAL, - physicalNetwork, - segmentationID); - new EqualsTester().addEqualityGroup(p1, p2).addEqualityGroup(p3) - .testEquals(); - } -} diff --git a/framework/src/onos/apps/vtn/vtnrsc/src/test/java/org/onosproject/vtnrsc/DefaultPortChainTest.java b/framework/src/onos/apps/vtn/vtnrsc/src/test/java/org/onosproject/vtnrsc/DefaultPortChainTest.java deleted file mode 100644 index 27234ac3..00000000 --- a/framework/src/onos/apps/vtn/vtnrsc/src/test/java/org/onosproject/vtnrsc/DefaultPortChainTest.java +++ /dev/null @@ -1,134 +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.vtnrsc; - -import java.util.LinkedList; -import java.util.List; - -import org.junit.Test; - -import com.google.common.testing.EqualsTester; - -import static org.hamcrest.MatcherAssert.assertThat; -import static org.hamcrest.Matchers.is; -import static org.onlab.junit.ImmutableClassChecker.assertThatClassIsImmutable; - -/** - * Unit tests for DefaultPortChain class. - */ -public class DefaultPortChainTest { - /** - * Checks that the DefaultPortChain class is immutable. - */ - @Test - public void testImmutability() { - assertThatClassIsImmutable(DefaultPortChain.class); - } - - /** - * Checks the operation of equals() methods. - */ - @Test - public void testEquals() { - // Create same two port chain objects. - final PortChainId portChainId = PortChainId.of("78888888-fc23-aeb6-f44b-56dc5e2fb3ae"); - final TenantId tenantId = TenantId.tenantId("1"); - final String name = "PortChain1"; - final String description = "PortChain1"; - // create list of Port Pair Groups. - final List<PortPairGroupId> portPairGroups = new LinkedList<PortPairGroupId>(); - PortPairGroupId portPairGroupId = PortPairGroupId.of("73333333-fc23-aeb6-f44b-56dc5e2fb3ae"); - portPairGroups.add(portPairGroupId); - portPairGroupId = PortPairGroupId.of("73333333-fc23-aeb6-f44b-56dc5e2fb3af"); - portPairGroups.add(portPairGroupId); - // create list of Flow classifiers. - final List<FlowClassifierId> flowClassifiers = new LinkedList<FlowClassifierId>(); - FlowClassifierId flowClassifierId = FlowClassifierId.of("74444444-fc23-aeb6-f44b-56dc5e2fb3ae"); - flowClassifiers.add(flowClassifierId); - flowClassifierId = FlowClassifierId.of("74444444-fc23-aeb6-f44b-56dc5e2fb3af"); - flowClassifiers.add(flowClassifierId); - - DefaultPortChain.Builder portChainBuilder = new DefaultPortChain.Builder(); - final PortChain portChain1 = portChainBuilder.setId(portChainId).setTenantId(tenantId).setName(name) - .setDescription(description).setPortPairGroups(portPairGroups).setFlowClassifiers(flowClassifiers) - .build(); - - portChainBuilder = new DefaultPortChain.Builder(); - final PortChain samePortChain1 = portChainBuilder.setId(portChainId).setTenantId(tenantId).setName(name) - .setDescription(description).setPortPairGroups(portPairGroups).setFlowClassifiers(flowClassifiers) - .build(); - - // Create different port chain object. - final PortChainId portChainId2 = PortChainId.of("79999999-fc23-aeb6-f44b-56dc5e2fb3ae"); - final TenantId tenantId2 = TenantId.tenantId("2"); - final String name2 = "PortChain2"; - final String description2 = "PortChain2"; - // create list of Port Pair Groups. - final List<PortPairGroupId> portPairGroups2 = new LinkedList<PortPairGroupId>(); - portPairGroupId = PortPairGroupId.of("75555555-fc23-aeb6-f44b-56dc5e2fb3ae"); - portPairGroups2.add(portPairGroupId); - portPairGroupId = PortPairGroupId.of("75555555-fc23-aeb6-f44b-56dc5e2fb3af"); - portPairGroups2.add(portPairGroupId); - // create list of Flow classifiers. - final List<FlowClassifierId> flowClassifiers2 = new LinkedList<FlowClassifierId>(); - flowClassifierId = FlowClassifierId.of("76666666-fc23-aeb6-f44b-56dc5e2fb3ae"); - flowClassifiers2.add(flowClassifierId); - flowClassifierId = FlowClassifierId.of("76666666-fc23-aeb6-f44b-56dc5e2fb3af"); - flowClassifiers2.add(flowClassifierId); - - portChainBuilder = new DefaultPortChain.Builder(); - final PortChain portChain2 = portChainBuilder.setId(portChainId2).setTenantId(tenantId2).setName(name2) - .setDescription(description2).setPortPairGroups(portPairGroups2).setFlowClassifiers(flowClassifiers2) - .build(); - - new EqualsTester().addEqualityGroup(portChain1, samePortChain1).addEqualityGroup(portChain2).testEquals(); - } - - /** - * Checks the construction of a DefaultPortChain object. - */ - @Test - public void testConstruction() { - final PortChainId portChainId = PortChainId.of("78888888-fc23-aeb6-f44b-56dc5e2fb3ae"); - final TenantId tenantId = TenantId.tenantId("1"); - final String name = "PortChain"; - final String description = "PortChain"; - // create list of Port Pair Groups. - final List<PortPairGroupId> portPairGroups = new LinkedList<PortPairGroupId>(); - PortPairGroupId portPairGroupId = PortPairGroupId.of("73333333-fc23-aeb6-f44b-56dc5e2fb3ae"); - portPairGroups.add(portPairGroupId); - portPairGroupId = PortPairGroupId.of("73333333-fc23-aeb6-f44b-56dc5e2fb3af"); - portPairGroups.add(portPairGroupId); - // create list of Flow classifiers. - final List<FlowClassifierId> flowClassifiers = new LinkedList<FlowClassifierId>(); - FlowClassifierId flowClassifierId = FlowClassifierId.of("74444444-fc23-aeb6-f44b-56dc5e2fb3ae"); - flowClassifiers.add(flowClassifierId); - flowClassifierId = FlowClassifierId.of("74444444-fc23-aeb6-f44b-56dc5e2fb3af"); - flowClassifiers.add(flowClassifierId); - - DefaultPortChain.Builder portChainBuilder = new DefaultPortChain.Builder(); - final PortChain portChain = portChainBuilder.setId(portChainId).setTenantId(tenantId).setName(name) - .setDescription(description).setPortPairGroups(portPairGroups).setFlowClassifiers(flowClassifiers) - .build(); - - assertThat(portChainId, is(portChain.portChainId())); - assertThat(tenantId, is(portChain.tenantId())); - assertThat(name, is(portChain.name())); - assertThat(description, is(portChain.description())); - assertThat(portPairGroups, is(portChain.portPairGroups())); - assertThat(flowClassifiers, is(portChain.flowClassifiers())); - } -} diff --git a/framework/src/onos/apps/vtn/vtnrsc/src/test/java/org/onosproject/vtnrsc/DefaultPortPairGroupTest.java b/framework/src/onos/apps/vtn/vtnrsc/src/test/java/org/onosproject/vtnrsc/DefaultPortPairGroupTest.java deleted file mode 100644 index 1b484e94..00000000 --- a/framework/src/onos/apps/vtn/vtnrsc/src/test/java/org/onosproject/vtnrsc/DefaultPortPairGroupTest.java +++ /dev/null @@ -1,112 +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.vtnrsc; - -import java.util.LinkedList; -import java.util.List; - -import org.junit.Test; - -import com.google.common.testing.EqualsTester; - -import static org.hamcrest.MatcherAssert.assertThat; -import static org.hamcrest.Matchers.is; -import static org.onlab.junit.ImmutableClassChecker.assertThatClassIsImmutable; - -/** - * Unit tests for DefaultPortPairGroup class. - */ -public class DefaultPortPairGroupTest { - /** - * Checks that the DefaultPortPairGroup class is immutable. - */ - @Test - public void testImmutability() { - assertThatClassIsImmutable(DefaultPortPairGroup.class); - } - - /** - * Checks the operation of equals() methods. - */ - @Test - public void testEquals() { - // Create same two port-pair-group objects. - final PortPairGroupId portPairGroupId = PortPairGroupId.of("78888888-fc23-aeb6-f44b-56dc5e2fb3ae"); - final TenantId tenantId = TenantId.tenantId("1"); - final String name = "PortPairGroup1"; - final String description = "PortPairGroup1"; - // create port-pair-id list - final List<PortPairId> portPairList = new LinkedList<PortPairId>(); - PortPairId portPairId = PortPairId.of("73333333-fc23-aeb6-f44b-56dc5e2fb3ae"); - portPairList.add(portPairId); - portPairId = PortPairId.of("74444444-fc23-aeb6-f44b-56dc5e2fb3ae"); - portPairList.add(portPairId); - - DefaultPortPairGroup.Builder portPairGroupBuilder = new DefaultPortPairGroup.Builder(); - final PortPairGroup portPairGroup1 = portPairGroupBuilder.setId(portPairGroupId).setTenantId(tenantId) - .setName(name).setDescription(description).setPortPairs(portPairList).build(); - - portPairGroupBuilder = new DefaultPortPairGroup.Builder(); - final PortPairGroup samePortPairGroup1 = portPairGroupBuilder.setId(portPairGroupId).setTenantId(tenantId) - .setName(name).setDescription(description).setPortPairs(portPairList).build(); - - // Create different port-pair-group object. - final PortPairGroupId portPairGroupId2 = PortPairGroupId.of("79999999-fc23-aeb6-f44b-56dc5e2fb3ae"); - final TenantId tenantId2 = TenantId.tenantId("2"); - final String name2 = "PortPairGroup2"; - final String description2 = "PortPairGroup2"; - // create port-pair-id list - final List<PortPairId> portPairList2 = new LinkedList<PortPairId>(); - portPairId = PortPairId.of("75555555-fc23-aeb6-f44b-56dc5e2fb3ae"); - portPairList2.add(portPairId); - portPairId = PortPairId.of("75555555-fc23-aeb6-f44b-56dc5e2fb3ae"); - portPairList2.add(portPairId); - - portPairGroupBuilder = new DefaultPortPairGroup.Builder(); - final PortPairGroup portPairGroup2 = portPairGroupBuilder.setId(portPairGroupId2).setTenantId(tenantId2) - .setName(name2).setDescription(description2).setPortPairs(portPairList2).build(); - - new EqualsTester().addEqualityGroup(portPairGroup1, samePortPairGroup1).addEqualityGroup(portPairGroup2) - .testEquals(); - } - - /** - * Checks the construction of a DefaultPortPairGroup object. - */ - @Test - public void testConstruction() { - final PortPairGroupId portPairGroupId = PortPairGroupId.of("78888888-fc23-aeb6-f44b-56dc5e2fb3ae"); - final TenantId tenantId = TenantId.tenantId("1"); - final String name = "PortPairGroup"; - final String description = "PortPairGroup"; - // create port-pair-id list - final List<PortPairId> portPairList = new LinkedList<PortPairId>(); - PortPairId portPairId = PortPairId.of("73333333-fc23-aeb6-f44b-56dc5e2fb3ae"); - portPairList.add(portPairId); - portPairId = PortPairId.of("74444444-fc23-aeb6-f44b-56dc5e2fb3ae"); - portPairList.add(portPairId); - - DefaultPortPairGroup.Builder portPairGroupBuilder = new DefaultPortPairGroup.Builder(); - final PortPairGroup portPairGroup = portPairGroupBuilder.setId(portPairGroupId).setTenantId(tenantId) - .setName(name).setDescription(description).setPortPairs(portPairList).build(); - - assertThat(portPairGroupId, is(portPairGroup.portPairGroupId())); - assertThat(tenantId, is(portPairGroup.tenantId())); - assertThat(name, is(portPairGroup.name())); - assertThat(description, is(portPairGroup.description())); - assertThat(portPairList, is(portPairGroup.portPairs())); - } -} diff --git a/framework/src/onos/apps/vtn/vtnrsc/src/test/java/org/onosproject/vtnrsc/DefaultPortPairTest.java b/framework/src/onos/apps/vtn/vtnrsc/src/test/java/org/onosproject/vtnrsc/DefaultPortPairTest.java deleted file mode 100644 index c8004ce6..00000000 --- a/framework/src/onos/apps/vtn/vtnrsc/src/test/java/org/onosproject/vtnrsc/DefaultPortPairTest.java +++ /dev/null @@ -1,97 +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.vtnrsc; - -import org.junit.Test; - -import com.google.common.testing.EqualsTester; - -import static org.hamcrest.MatcherAssert.assertThat; -import static org.hamcrest.Matchers.is; -import static org.onlab.junit.ImmutableClassChecker.assertThatClassIsImmutable; - -/** - * Unit tests for DefaultPortPair class. - */ -public class DefaultPortPairTest { - /** - * Checks that the DefaultPortPair class is immutable. - */ - @Test - public void testImmutability() { - assertThatClassIsImmutable(DefaultPortPair.class); - } - - /** - * Checks the operation of equals() methods. - */ - @Test - public void testEquals() { - // Create same two port pair objects. - final PortPairId portPairId = PortPairId.of("78888888-fc23-aeb6-f44b-56dc5e2fb3ae"); - final TenantId tenantId = TenantId.tenantId("1"); - final String name = "PortPair1"; - final String description = "PortPair1"; - final String ingress = "d3333333-24fc-4fae-af4b-321c5e2eb3d1"; - final String egress = "a4444444-4a56-2a6e-cd3a-9dee4e2ec345"; - - DefaultPortPair.Builder portPairBuilder = new DefaultPortPair.Builder(); - final PortPair portPair1 = portPairBuilder.setId(portPairId).setTenantId(tenantId).setName(name) - .setDescription(description).setIngress(ingress).setEgress(egress).build(); - - portPairBuilder = new DefaultPortPair.Builder(); - final PortPair samePortPair1 = portPairBuilder.setId(portPairId).setTenantId(tenantId).setName(name) - .setDescription(description).setIngress(ingress).setEgress(egress).build(); - - // Create different port pair object. - final PortPairId portPairId2 = PortPairId.of("79999999-fc23-aeb6-f44b-56dc5e2fb3ae"); - final TenantId tenantId2 = TenantId.tenantId("2"); - final String name2 = "PortPair2"; - final String description2 = "PortPair2"; - final String ingress2 = "d5555555-24fc-4fae-af4b-321c5e2eb3d1"; - final String egress2 = "a6666666-4a56-2a6e-cd3a-9dee4e2ec345"; - - portPairBuilder = new DefaultPortPair.Builder(); - final PortPair portPair2 = portPairBuilder.setId(portPairId2).setTenantId(tenantId2).setName(name2) - .setDescription(description2).setIngress(ingress2).setEgress(egress2).build(); - - new EqualsTester().addEqualityGroup(portPair1, samePortPair1).addEqualityGroup(portPair2).testEquals(); - } - - /** - * Checks the construction of a DefaultPortPair object. - */ - @Test - public void testConstruction() { - final PortPairId portPairId = PortPairId.of("78888888-fc23-aeb6-f44b-56dc5e2fb3ae"); - final TenantId tenantId = TenantId.tenantId("1"); - final String name = "PortPair"; - final String description = "PortPair"; - final String ingress = "d3333333-24fc-4fae-af4b-321c5e2eb3d1"; - final String egress = "a4444444-4a56-2a6e-cd3a-9dee4e2ec345"; - - DefaultPortPair.Builder portPairBuilder = new DefaultPortPair.Builder(); - final PortPair portPair = portPairBuilder.setId(portPairId).setTenantId(tenantId).setName(name) - .setDescription(description).setIngress(ingress).setEgress(egress).build(); - - assertThat(portPairId, is(portPair.portPairId())); - assertThat(tenantId, is(portPair.tenantId())); - assertThat(name, is(portPair.name())); - assertThat(description, is(portPair.description())); - assertThat(ingress, is(portPair.ingress())); - assertThat(egress, is(portPair.egress())); - } -} diff --git a/framework/src/onos/apps/vtn/vtnrsc/src/test/java/org/onosproject/vtnrsc/DefaultVirtualPortTest.java b/framework/src/onos/apps/vtn/vtnrsc/src/test/java/org/onosproject/vtnrsc/DefaultVirtualPortTest.java deleted file mode 100644 index 81d8b14d..00000000 --- a/framework/src/onos/apps/vtn/vtnrsc/src/test/java/org/onosproject/vtnrsc/DefaultVirtualPortTest.java +++ /dev/null @@ -1,132 +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.vtnrsc; - -import java.util.Map; -import java.util.Set; - -import org.junit.Test; -import org.onlab.packet.IpAddress; -import org.onlab.packet.MacAddress; -import org.onosproject.net.DeviceId; - -import com.google.common.collect.Maps; -import com.google.common.collect.Sets; -import com.google.common.testing.EqualsTester; - -import static org.onlab.junit.ImmutableClassChecker.assertThatClassIsImmutable; - -/** - * Unit tests for DefaultVirtualPort class. - */ -public class DefaultVirtualPortTest { - - private Set<FixedIp> fixedIps; - private Map<String, String> propertyMap; - private Set<AllowedAddressPair> allowedAddressPairs; - private Set<SecurityGroup> securityGroups; - private VirtualPortId id1; - private VirtualPortId id2; - private String macAddressStr = "fa:12:3e:56:ee:a2"; - private String ipAddress = "10.1.1.1"; - private String deviceStr = "of:000000000000001"; - private String tenantIdStr = "123"; - private String portId1 = "1241"; - private String portId2 = "1242"; - private String tenantNetworkId = "1234567"; - private String subnet = "1212"; - private String hostIdStr = "fa:e2:3e:56:ee:a2"; - - private void initVirtualPortId() { - id1 = VirtualPortId.portId(portId1); - id2 = VirtualPortId.portId(portId2); - } - - private void initFixedIpSet() { - FixedIp fixedIp = FixedIp.fixedIp(SubnetId.subnetId(subnet), - IpAddress.valueOf(ipAddress)); - fixedIps = Sets.newHashSet(); - fixedIps.add(fixedIp); - } - - private void initPropertyMap() { - String deviceOwner = "james"; - propertyMap = Maps.newHashMap(); - propertyMap.putIfAbsent("deviceOwner", deviceOwner); - } - - private void initAddressPairSet() { - allowedAddressPairs = Sets.newHashSet(); - AllowedAddressPair allowedAddressPair = AllowedAddressPair - .allowedAddressPair(IpAddress.valueOf(ipAddress), - MacAddress.valueOf(macAddressStr)); - allowedAddressPairs.add(allowedAddressPair); - } - - private void initSecurityGroupSet() { - securityGroups = Sets.newHashSet(); - } - - /** - * Checks that the DefaultVirtualPort class is immutable. - */ - @Test - public void testImmutability() { - assertThatClassIsImmutable(SecurityGroup.class); - } - - /** - * Checks the operation of equals(). - */ - @Test - public void testEquals() { - initVirtualPortId(); - initFixedIpSet(); - initPropertyMap(); - initAddressPairSet(); - initSecurityGroupSet(); - TenantNetworkId networkId = TenantNetworkId.networkId(tenantNetworkId); - MacAddress macAddress = MacAddress.valueOf(macAddressStr); - TenantId tenantId = TenantId.tenantId(tenantIdStr); - DeviceId deviceId = DeviceId.deviceId(deviceStr); - BindingHostId bindingHostId = BindingHostId.bindingHostId(hostIdStr); - - VirtualPort d1 = new DefaultVirtualPort(id1, networkId, true, - propertyMap, - VirtualPort.State.ACTIVE, - macAddress, tenantId, deviceId, - fixedIps, bindingHostId, - allowedAddressPairs, - securityGroups); - VirtualPort d2 = new DefaultVirtualPort(id1, networkId, true, - propertyMap, - VirtualPort.State.ACTIVE, - macAddress, tenantId, deviceId, - fixedIps, bindingHostId, - allowedAddressPairs, - securityGroups); - VirtualPort d3 = new DefaultVirtualPort(id2, networkId, true, - propertyMap, - VirtualPort.State.ACTIVE, - macAddress, tenantId, deviceId, - fixedIps, bindingHostId, - allowedAddressPairs, - securityGroups); - new EqualsTester().addEqualityGroup(d1, d2).addEqualityGroup(d3) - .testEquals(); - } -} diff --git a/framework/src/onos/apps/vtn/vtnrsc/src/test/java/org/onosproject/vtnrsc/FixedIpTest.java b/framework/src/onos/apps/vtn/vtnrsc/src/test/java/org/onosproject/vtnrsc/FixedIpTest.java deleted file mode 100644 index d77532a7..00000000 --- a/framework/src/onos/apps/vtn/vtnrsc/src/test/java/org/onosproject/vtnrsc/FixedIpTest.java +++ /dev/null @@ -1,70 +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.vtnrsc; - -import org.junit.Test; -import org.onlab.packet.IpAddress; - -import com.google.common.testing.EqualsTester; - -import static org.hamcrest.MatcherAssert.assertThat; -import static org.hamcrest.Matchers.is; -import static org.hamcrest.Matchers.notNullValue; -import static org.onlab.junit.ImmutableClassChecker.assertThatClassIsImmutable; - -/** - * Unit tests for FixedIp class. - */ -public class FixedIpTest { - - final SubnetId subnetId1 = SubnetId.subnetId("lef11-95w-4er-9c9c"); - final SubnetId subnetId2 = SubnetId.subnetId("lefaa-95w-4er-9c9c"); - final IpAddress ip1 = IpAddress.valueOf("192.168.0.1"); - final IpAddress ip2 = IpAddress.valueOf("192.168.1.1"); - - /** - * Checks that the FixedIp class is immutable. - */ - @Test - public void testImmutability() { - assertThatClassIsImmutable(FixedIp.class); - } - - /** - * Checks the operation of equals(). - */ - @Test - public void testEquals() { - FixedIp fixedIp1 = FixedIp.fixedIp(subnetId1, ip1); - FixedIp fixedIp2 = FixedIp.fixedIp(subnetId1, ip1); - FixedIp fixedIp3 = FixedIp.fixedIp(subnetId2, ip2); - new EqualsTester().addEqualityGroup(fixedIp1, fixedIp2) - .addEqualityGroup(fixedIp3).testEquals(); - } - - /** - * Checks the construction of a FixedIp object. - */ - @Test - public void testConstruction() { - FixedIp fixedIp = FixedIp.fixedIp(subnetId1, ip1); - assertThat(ip1, is(notNullValue())); - assertThat(ip1, is(fixedIp.ip())); - assertThat(subnetId1, is(notNullValue())); - assertThat(subnetId1, is(fixedIp.subnetId())); - } -} diff --git a/framework/src/onos/apps/vtn/vtnrsc/src/test/java/org/onosproject/vtnrsc/FlowClassifierIdTest.java b/framework/src/onos/apps/vtn/vtnrsc/src/test/java/org/onosproject/vtnrsc/FlowClassifierIdTest.java deleted file mode 100644 index 0bef00fc..00000000 --- a/framework/src/onos/apps/vtn/vtnrsc/src/test/java/org/onosproject/vtnrsc/FlowClassifierIdTest.java +++ /dev/null @@ -1,68 +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.vtnrsc; - -import java.util.UUID; - -import org.junit.Test; - -import com.google.common.testing.EqualsTester; - -import static org.hamcrest.MatcherAssert.assertThat; -import static org.hamcrest.Matchers.is; -import static org.hamcrest.Matchers.notNullValue; -import static org.onlab.junit.ImmutableClassChecker.assertThatClassIsImmutable; - -/** - * Unit tests for FlowClassifierId class. - */ -public class FlowClassifierIdTest { - - final FlowClassifierId flowClassifierId1 = FlowClassifierId - .of("78dcd363-fc23-aeb6-f44b-56dc5e2fb3ae"); - final FlowClassifierId sameAsFlowClassifierId1 = FlowClassifierId - .of("78dcd363-fc23-aeb6-f44b-56dc5e2fb3ae"); - final FlowClassifierId flowClassifierId2 = FlowClassifierId - .of("dace4513-24fc-4fae-af4b-321c5e2eb3d1"); - - /** - * Checks that the FlowClassifierId class is immutable. - */ - @Test - public void testImmutability() { - assertThatClassIsImmutable(FlowClassifierId.class); - } - - /** - * Checks the operation of equals() methods. - */ - @Test - public void testEquals() { - new EqualsTester().addEqualityGroup(flowClassifierId1, sameAsFlowClassifierId1) - .addEqualityGroup(flowClassifierId2).testEquals(); - } - - /** - * Checks the construction of a FlowClassifierId object. - */ - @Test - public void testConstruction() { - final String flowClassifierIdValue = "dace4513-24fc-4fae-af4b-321c5e2eb3d1"; - final FlowClassifierId flowClassifierId = FlowClassifierId.of(flowClassifierIdValue); - assertThat(flowClassifierId, is(notNullValue())); - assertThat(flowClassifierId.value(), is(UUID.fromString(flowClassifierIdValue))); - } -} diff --git a/framework/src/onos/apps/vtn/vtnrsc/src/test/java/org/onosproject/vtnrsc/PhysicalNetworkTest.java b/framework/src/onos/apps/vtn/vtnrsc/src/test/java/org/onosproject/vtnrsc/PhysicalNetworkTest.java deleted file mode 100644 index c4f591e7..00000000 --- a/framework/src/onos/apps/vtn/vtnrsc/src/test/java/org/onosproject/vtnrsc/PhysicalNetworkTest.java +++ /dev/null @@ -1,64 +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.vtnrsc; - -import org.junit.Test; - -import com.google.common.testing.EqualsTester; - -import static org.hamcrest.MatcherAssert.assertThat; -import static org.hamcrest.Matchers.is; -import static org.hamcrest.Matchers.notNullValue; -import static org.onlab.junit.ImmutableClassChecker.assertThatClassIsImmutable; - -/** - * Unit tests for PhysicalNetwork class. - */ -public class PhysicalNetworkTest { - - final PhysicalNetwork physicalNetwork1 = PhysicalNetwork.physicalNetwork("1"); - final PhysicalNetwork sameAsPhysicalNetwork1 = PhysicalNetwork.physicalNetwork("1"); - final PhysicalNetwork physicalNetwork2 = PhysicalNetwork.physicalNetwork("2"); - - /** - * Checks that the PhysicalNetwork class is immutable. - */ - @Test - public void testImmutability() { - assertThatClassIsImmutable(PhysicalNetwork.class); - } - - /** - * Checks the operation of equals() methods. - */ - @Test - public void testEquals() { - new EqualsTester().addEqualityGroup(physicalNetwork1, sameAsPhysicalNetwork1) - .addEqualityGroup(physicalNetwork2).testEquals(); - } - - /** - * Checks the construction of a PhysicalNetwork object. - */ - @Test - public void testConstruction() { - final String physicalNetworkValue = "s"; - final PhysicalNetwork physicalNetwork = PhysicalNetwork - .physicalNetwork(physicalNetworkValue); - assertThat(physicalNetwork, is(notNullValue())); - assertThat(physicalNetwork.physicalNetwork(), is(physicalNetworkValue)); - } -} diff --git a/framework/src/onos/apps/vtn/vtnrsc/src/test/java/org/onosproject/vtnrsc/PortChainIdTest.java b/framework/src/onos/apps/vtn/vtnrsc/src/test/java/org/onosproject/vtnrsc/PortChainIdTest.java deleted file mode 100644 index 1e84fc5d..00000000 --- a/framework/src/onos/apps/vtn/vtnrsc/src/test/java/org/onosproject/vtnrsc/PortChainIdTest.java +++ /dev/null @@ -1,65 +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.vtnrsc; - -import java.util.UUID; - -import org.junit.Test; - -import com.google.common.testing.EqualsTester; - -import static org.hamcrest.MatcherAssert.assertThat; -import static org.hamcrest.Matchers.is; -import static org.hamcrest.Matchers.notNullValue; -import static org.onlab.junit.ImmutableClassChecker.assertThatClassIsImmutable; - -/** - * Unit tests for PortChainId class. - */ -public class PortChainIdTest { - - final PortChainId portChainId1 = PortChainId.of("78dcd363-fc23-aeb6-f44b-56dc5e2fb3ae"); - final PortChainId sameAsPortChainId1 = PortChainId.of("78dcd363-fc23-aeb6-f44b-56dc5e2fb3ae"); - final PortChainId portChainId2 = PortChainId.of("dace4513-24fc-4fae-af4b-321c5e2eb3d1"); - - /** - * Checks that the PortChainId class is immutable. - */ - @Test - public void testImmutability() { - assertThatClassIsImmutable(PortChainId.class); - } - - /** - * Checks the operation of equals() methods. - */ - @Test - public void testEquals() { - new EqualsTester().addEqualityGroup(portChainId1, sameAsPortChainId1).addEqualityGroup(portChainId2) - .testEquals(); - } - - /** - * Checks the construction of a PortChainId object. - */ - @Test - public void testConstruction() { - final String portChainIdValue = "dace4513-24fc-4fae-af4b-321c5e2eb3d1"; - final PortChainId portChainId = PortChainId.of(portChainIdValue); - assertThat(portChainId, is(notNullValue())); - assertThat(portChainId.value(), is(UUID.fromString(portChainIdValue))); - } -} diff --git a/framework/src/onos/apps/vtn/vtnrsc/src/test/java/org/onosproject/vtnrsc/PortPairGroupIdTest.java b/framework/src/onos/apps/vtn/vtnrsc/src/test/java/org/onosproject/vtnrsc/PortPairGroupIdTest.java deleted file mode 100644 index 20eb24a5..00000000 --- a/framework/src/onos/apps/vtn/vtnrsc/src/test/java/org/onosproject/vtnrsc/PortPairGroupIdTest.java +++ /dev/null @@ -1,66 +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.vtnrsc; - -import java.util.UUID; - -import org.junit.Test; - -import com.google.common.testing.EqualsTester; - -import static org.hamcrest.MatcherAssert.assertThat; -import static org.hamcrest.Matchers.is; -import static org.hamcrest.Matchers.notNullValue; -import static org.onlab.junit.ImmutableClassChecker.assertThatClassIsImmutable; - -/** - * Unit tests for PortPairGroupId class. - */ -public class PortPairGroupIdTest { - - final PortPairGroupId portPairGroupId1 = PortPairGroupId.of("78dcd363-fc23-aeb6-f44b-56dc5e2fb3ae"); - final PortPairGroupId sameAsPortPairGroupId1 = PortPairGroupId - .of("78dcd363-fc23-aeb6-f44b-56dc5e2fb3ae"); - final PortPairGroupId portPairGroupId2 = PortPairGroupId.of("dace4513-24fc-4fae-af4b-321c5e2eb3d1"); - - /** - * Checks that the PortPairGroupId class is immutable. - */ - @Test - public void testImmutability() { - assertThatClassIsImmutable(PortPairGroupId.class); - } - - /** - * Checks the operation of equals() methods. - */ - @Test - public void testEquals() { - new EqualsTester().addEqualityGroup(portPairGroupId1, sameAsPortPairGroupId1) - .addEqualityGroup(portPairGroupId2).testEquals(); - } - - /** - * Checks the construction of a PortPairGroupId object. - */ - @Test - public void testConstruction() { - final String portPairGroupIdValue = "dace4513-24fc-4fae-af4b-321c5e2eb3d1"; - final PortPairGroupId portPairGroupId = PortPairGroupId.of(portPairGroupIdValue); - assertThat(portPairGroupId, is(notNullValue())); - assertThat(portPairGroupId.value(), is(UUID.fromString(portPairGroupIdValue))); - } -} diff --git a/framework/src/onos/apps/vtn/vtnrsc/src/test/java/org/onosproject/vtnrsc/PortPairIdTest.java b/framework/src/onos/apps/vtn/vtnrsc/src/test/java/org/onosproject/vtnrsc/PortPairIdTest.java deleted file mode 100644 index 757d3a69..00000000 --- a/framework/src/onos/apps/vtn/vtnrsc/src/test/java/org/onosproject/vtnrsc/PortPairIdTest.java +++ /dev/null @@ -1,64 +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.vtnrsc; - -import java.util.UUID; - -import org.junit.Test; - -import com.google.common.testing.EqualsTester; - -import static org.hamcrest.MatcherAssert.assertThat; -import static org.hamcrest.Matchers.is; -import static org.hamcrest.Matchers.notNullValue; -import static org.onlab.junit.ImmutableClassChecker.assertThatClassIsImmutable; - -/** - * Unit tests for PortPairId class. - */ -public class PortPairIdTest { - - final PortPairId portPairId1 = PortPairId.of("78dcd363-fc23-aeb6-f44b-56dc5e2fb3ae"); - final PortPairId sameAsPortPairId1 = PortPairId.of("78dcd363-fc23-aeb6-f44b-56dc5e2fb3ae"); - final PortPairId portPairId2 = PortPairId.of("dace4513-24fc-4fae-af4b-321c5e2eb3d1"); - - /** - * Checks that the PortPairId class is immutable. - */ - @Test - public void testImmutability() { - assertThatClassIsImmutable(PortPairId.class); - } - - /** - * Checks the operation of equals() methods. - */ - @Test - public void testEquals() { - new EqualsTester().addEqualityGroup(portPairId1, sameAsPortPairId1).addEqualityGroup(portPairId2).testEquals(); - } - - /** - * Checks the construction of a PortPairId object. - */ - @Test - public void testConstruction() { - final String portPairIdValue = "dace4513-24fc-4fae-af4b-321c5e2eb3d1"; - final PortPairId portPairId = PortPairId.of(portPairIdValue); - assertThat(portPairId, is(notNullValue())); - assertThat(portPairId.value(), is(UUID.fromString(portPairIdValue))); - } -} diff --git a/framework/src/onos/apps/vtn/vtnrsc/src/test/java/org/onosproject/vtnrsc/RouterGatewayTest.java b/framework/src/onos/apps/vtn/vtnrsc/src/test/java/org/onosproject/vtnrsc/RouterGatewayTest.java deleted file mode 100644 index 9f60de8f..00000000 --- a/framework/src/onos/apps/vtn/vtnrsc/src/test/java/org/onosproject/vtnrsc/RouterGatewayTest.java +++ /dev/null @@ -1,79 +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.vtnrsc; - -import java.util.HashSet; -import java.util.Set; - -import org.junit.Test; - -import com.google.common.testing.EqualsTester; - -import static org.hamcrest.MatcherAssert.assertThat; -import static org.hamcrest.Matchers.is; -import static org.hamcrest.Matchers.notNullValue; -import static org.onlab.junit.ImmutableClassChecker.assertThatClassIsImmutable; - -/** - * Unit tests for RouterGateway class. - */ -public class RouterGatewayTest { - final TenantNetworkId networkId1 = TenantNetworkId.networkId("1"); - final TenantNetworkId networkId2 = TenantNetworkId.networkId("2"); - final Set<FixedIp> fixedIpSet1 = new HashSet<>(); - final Set<FixedIp> fixedIpSet2 = new HashSet<>(); - - /** - * Checks that the RouterGateway class is immutable. - */ - @Test - public void testImmutability() { - assertThatClassIsImmutable(RouterGateway.class); - } - - /** - * Checks the operation of equals(). - */ - @Test - public void testEquals() { - RouterGateway routerGateway1 = RouterGateway.routerGateway(networkId1, - true, - fixedIpSet1); - RouterGateway routerGateway2 = RouterGateway.routerGateway(networkId1, - true, - fixedIpSet1); - RouterGateway routerGateway3 = RouterGateway.routerGateway(networkId2, - true, - fixedIpSet2); - new EqualsTester().addEqualityGroup(routerGateway1, routerGateway2) - .addEqualityGroup(routerGateway3).testEquals(); - } - - /** - * Checks the construction of a RouterGateway object. - */ - @Test - public void testConstruction() { - RouterGateway routerGateway = RouterGateway.routerGateway(networkId1, - true, - fixedIpSet1); - assertThat(fixedIpSet1, is(notNullValue())); - assertThat(fixedIpSet1, is(routerGateway.externalFixedIps())); - assertThat(networkId1, is(notNullValue())); - assertThat(networkId1, is(routerGateway.networkId())); - assertThat(routerGateway.enableSnat(), is(true)); - } -} diff --git a/framework/src/onos/apps/vtn/vtnrsc/src/test/java/org/onosproject/vtnrsc/RouterIdTest.java b/framework/src/onos/apps/vtn/vtnrsc/src/test/java/org/onosproject/vtnrsc/RouterIdTest.java deleted file mode 100644 index 225211b9..00000000 --- a/framework/src/onos/apps/vtn/vtnrsc/src/test/java/org/onosproject/vtnrsc/RouterIdTest.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.vtnrsc; - -import org.junit.Test; - -import com.google.common.testing.EqualsTester; - -import static org.hamcrest.MatcherAssert.assertThat; -import static org.hamcrest.Matchers.is; -import static org.hamcrest.Matchers.notNullValue; -import static org.onlab.junit.ImmutableClassChecker.assertThatClassIsImmutable; - -/** - * Unit tests for RouterId class. - */ -public class RouterIdTest { - final RouterId routerId1 = RouterId.valueOf("1"); - final RouterId sameAsRouterId1 = RouterId.valueOf("1"); - final RouterId routerId2 = RouterId.valueOf("2"); - - /** - * Checks that the RouterId class is immutable. - */ - @Test - public void testImmutability() { - assertThatClassIsImmutable(RouterId.class); - } - - /** - * Checks the operation of equals() methods. - */ - @Test - public void testEquals() { - new EqualsTester().addEqualityGroup(routerId1, sameAsRouterId1).addEqualityGroup(routerId2) - .testEquals(); - } - - /** - * Checks the construction of a RouterId object. - */ - @Test - public void testConstruction() { - final String routerIdValue = "s"; - final RouterId routerId = RouterId.valueOf(routerIdValue); - assertThat(routerId, is(notNullValue())); - assertThat(routerId.routerId(), is(routerIdValue)); - } -} diff --git a/framework/src/onos/apps/vtn/vtnrsc/src/test/java/org/onosproject/vtnrsc/SecurityGroupTest.java b/framework/src/onos/apps/vtn/vtnrsc/src/test/java/org/onosproject/vtnrsc/SecurityGroupTest.java deleted file mode 100644 index 20871c02..00000000 --- a/framework/src/onos/apps/vtn/vtnrsc/src/test/java/org/onosproject/vtnrsc/SecurityGroupTest.java +++ /dev/null @@ -1,65 +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.vtnrsc; - -import org.junit.Test; - -import com.google.common.testing.EqualsTester; - -import static org.hamcrest.MatcherAssert.assertThat; -import static org.hamcrest.Matchers.is; -import static org.hamcrest.Matchers.notNullValue; -import static org.onlab.junit.ImmutableClassChecker.assertThatClassIsImmutable; - -/** - * Unit tests for SecurityGroup class. - */ -public class SecurityGroupTest { - - final SecurityGroup securityGroup1 = SecurityGroup.securityGroup("1"); - final SecurityGroup sameAssecurityGroup = SecurityGroup.securityGroup("1"); - final SecurityGroup securityGroup2 = SecurityGroup.securityGroup("2"); - - /** - * Checks that the SecurityGroup class is immutable. - */ - @Test - public void testImmutability() { - assertThatClassIsImmutable(SecurityGroup.class); - } - - /** - * Checks the operation of equals(). - */ - @Test - public void testEquals() { - new EqualsTester().addEqualityGroup(securityGroup1, sameAssecurityGroup) - .addEqualityGroup(securityGroup2).testEquals(); - } - - /** - * Checks the construction of a SecurityGroup object. - */ - @Test - public void testConstruction() { - final String securityGroupValue = "1"; - final SecurityGroup securityGroup = SecurityGroup.securityGroup(securityGroupValue); - assertThat(securityGroup, is(notNullValue())); - assertThat(securityGroup.securityGroup(), is(securityGroupValue)); - - } -} diff --git a/framework/src/onos/apps/vtn/vtnrsc/src/test/java/org/onosproject/vtnrsc/SegmentationIdTest.java b/framework/src/onos/apps/vtn/vtnrsc/src/test/java/org/onosproject/vtnrsc/SegmentationIdTest.java deleted file mode 100644 index dfb3dcf8..00000000 --- a/framework/src/onos/apps/vtn/vtnrsc/src/test/java/org/onosproject/vtnrsc/SegmentationIdTest.java +++ /dev/null @@ -1,63 +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.vtnrsc; - -import org.junit.Test; - -import com.google.common.testing.EqualsTester; - -import static org.hamcrest.MatcherAssert.assertThat; -import static org.hamcrest.Matchers.is; -import static org.hamcrest.Matchers.notNullValue; -import static org.onlab.junit.ImmutableClassChecker.assertThatClassIsImmutable; - -/** - * Unit tests for SegmentationId class. - */ -public class SegmentationIdTest { - - final SegmentationId segmentationID1 = SegmentationId.segmentationId("1"); - final SegmentationId sameAsSegmentationID1 = SegmentationId.segmentationId("1"); - final SegmentationId segmentationID2 = SegmentationId.segmentationId("2"); - - /** - * Checks that the SegmentationId class is immutable. - */ - @Test - public void testImmutability() { - assertThatClassIsImmutable(SegmentationId.class); - } - - /** - * Checks the operation of equals() methods. - */ - @Test - public void testEquals() { - new EqualsTester().addEqualityGroup(segmentationID1, sameAsSegmentationID1) - .addEqualityGroup(segmentationID2).testEquals(); - } - - /** - * Checks the construction of a segmentationId object. - */ - @Test - public void testConstruction() { - final String segmentationIdValue = "s"; - final SegmentationId segmentationId = SegmentationId.segmentationId(segmentationIdValue); - assertThat(segmentationId, is(notNullValue())); - assertThat(segmentationId.segmentationId(), is(segmentationIdValue)); - } -} diff --git a/framework/src/onos/apps/vtn/vtnrsc/src/test/java/org/onosproject/vtnrsc/SubnetIdTest.java b/framework/src/onos/apps/vtn/vtnrsc/src/test/java/org/onosproject/vtnrsc/SubnetIdTest.java deleted file mode 100644 index 5a1809ce..00000000 --- a/framework/src/onos/apps/vtn/vtnrsc/src/test/java/org/onosproject/vtnrsc/SubnetIdTest.java +++ /dev/null @@ -1,63 +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.vtnrsc; - -import org.junit.Test; - -import com.google.common.testing.EqualsTester; - -import static org.hamcrest.MatcherAssert.assertThat; -import static org.hamcrest.Matchers.is; -import static org.hamcrest.Matchers.notNullValue; -import static org.onlab.junit.ImmutableClassChecker.assertThatClassIsImmutable; - -/** - * Unit tests for SubnetId class. - */ -public class SubnetIdTest { - - final SubnetId subnetId1 = SubnetId.subnetId("1"); - final SubnetId sameAsSubnetId1 = SubnetId.subnetId("1"); - final SubnetId subnetId2 = SubnetId.subnetId("2"); - - /** - * Checks that the SubnetId class is immutable. - */ - @Test - public void testImmutability() { - assertThatClassIsImmutable(SubnetId.class); - } - - /** - * Checks the operation of equals() methods. - */ - @Test - public void testEquals() { - new EqualsTester().addEqualityGroup(subnetId1, sameAsSubnetId1).addEqualityGroup(subnetId2) - .testEquals(); - } - - /** - * Checks the construction of a SubnetId object. - */ - @Test - public void testConstruction() { - final String subnetIdValue = "s"; - final SubnetId subnetId = SubnetId.subnetId(subnetIdValue); - assertThat(subnetId, is(notNullValue())); - assertThat(subnetId.subnetId(), is(subnetIdValue)); - } -} diff --git a/framework/src/onos/apps/vtn/vtnrsc/src/test/java/org/onosproject/vtnrsc/TenantIdTest.java b/framework/src/onos/apps/vtn/vtnrsc/src/test/java/org/onosproject/vtnrsc/TenantIdTest.java deleted file mode 100644 index f601d427..00000000 --- a/framework/src/onos/apps/vtn/vtnrsc/src/test/java/org/onosproject/vtnrsc/TenantIdTest.java +++ /dev/null @@ -1,63 +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.vtnrsc; - -import org.junit.Test; - -import com.google.common.testing.EqualsTester; - -import static org.hamcrest.MatcherAssert.assertThat; -import static org.hamcrest.Matchers.is; -import static org.hamcrest.Matchers.notNullValue; -import static org.onlab.junit.ImmutableClassChecker.assertThatClassIsImmutable; - -/** - * Unit tests for TenantId class. - */ -public class TenantIdTest { - - final TenantId tenantId1 = TenantId.tenantId("1"); - final TenantId sameAsTenantId1 = TenantId.tenantId("1"); - final TenantId tenantId2 = TenantId.tenantId("2"); - - /** - * Checks that the TenantId class is immutable. - */ - @Test - public void testImmutability() { - assertThatClassIsImmutable(TenantId.class); - } - - /** - * Checks the operation of equals() methods. - */ - @Test - public void testEquals() { - new EqualsTester().addEqualityGroup(tenantId1, sameAsTenantId1).addEqualityGroup(tenantId2) - .testEquals(); - } - - /** - * Checks the construction of a TenantId object. - */ - @Test - public void testConstruction() { - final String tenantIdValue = "s"; - final TenantId tenantId = TenantId.tenantId(tenantIdValue); - assertThat(tenantId, is(notNullValue())); - assertThat(tenantId.tenantId(), is(tenantIdValue)); - } -} diff --git a/framework/src/onos/apps/vtn/vtnrsc/src/test/java/org/onosproject/vtnrsc/TenantNetworkIdTest.java b/framework/src/onos/apps/vtn/vtnrsc/src/test/java/org/onosproject/vtnrsc/TenantNetworkIdTest.java deleted file mode 100644 index 3bd72026..00000000 --- a/framework/src/onos/apps/vtn/vtnrsc/src/test/java/org/onosproject/vtnrsc/TenantNetworkIdTest.java +++ /dev/null @@ -1,63 +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.vtnrsc; - -import org.junit.Test; - -import com.google.common.testing.EqualsTester; - -import static org.hamcrest.MatcherAssert.assertThat; -import static org.hamcrest.Matchers.is; -import static org.hamcrest.Matchers.notNullValue; -import static org.onlab.junit.ImmutableClassChecker.assertThatClassIsImmutable; - -/** - * Unit tests for TenantNetworkId class. - */ -public class TenantNetworkIdTest { - - final TenantNetworkId networkId1 = TenantNetworkId.networkId("1"); - final TenantNetworkId sameAsnetworkId1 = TenantNetworkId.networkId("1"); - final TenantNetworkId networkId2 = TenantNetworkId.networkId("2"); - - /** - * Checks that the TenantNetworkId class is immutable. - */ - @Test - public void testImmutability() { - assertThatClassIsImmutable(TenantNetworkId.class); - } - - /** - * Checks the operation of equals() methods. - */ - @Test - public void testEquals() { - new EqualsTester().addEqualityGroup(networkId1, sameAsnetworkId1) - .addEqualityGroup(networkId2).testEquals(); - } - - /** - * Checks the construction of a TenantNetworkId object. - */ - @Test - public void testConstruction() { - final String networkIdValue = "s"; - final TenantNetworkId networkId = TenantNetworkId.networkId(networkIdValue); - assertThat(networkId, is(notNullValue())); - assertThat(networkId.networkId(), is(networkIdValue)); - } -} diff --git a/framework/src/onos/apps/vtn/vtnrsc/src/test/java/org/onosproject/vtnrsc/VirtualPortIdTest.java b/framework/src/onos/apps/vtn/vtnrsc/src/test/java/org/onosproject/vtnrsc/VirtualPortIdTest.java deleted file mode 100644 index 70966118..00000000 --- a/framework/src/onos/apps/vtn/vtnrsc/src/test/java/org/onosproject/vtnrsc/VirtualPortIdTest.java +++ /dev/null @@ -1,65 +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.vtnrsc; - -import org.junit.Test; - -import com.google.common.testing.EqualsTester; - -import static org.hamcrest.MatcherAssert.assertThat; -import static org.hamcrest.Matchers.is; -import static org.hamcrest.Matchers.notNullValue; -import static org.onlab.junit.ImmutableClassChecker.assertThatClassIsImmutable; - -/** - * Unit tests for VirtualPortId class. - */ -public class VirtualPortIdTest { - - final VirtualPortId virtualPortId1 = VirtualPortId.portId("1"); - final VirtualPortId sameAsVirtualPortId1 = VirtualPortId.portId("1"); - final VirtualPortId virtualPortId2 = VirtualPortId.portId("2"); - - /** - * Checks that the VirtualPortId class is immutable. - */ - @Test - public void testImmutability() { - assertThatClassIsImmutable(VirtualPortId.class); - } - - /** - * Checks the operation of equals(). - */ - @Test - public void testEquals() { - new EqualsTester().addEqualityGroup(virtualPortId1, sameAsVirtualPortId1) - .addEqualityGroup(virtualPortId2).testEquals(); - } - - /** - * Checks the construction of a VirtualPortId object. - */ - @Test - public void testConstruction() { - final String vPortIdValue = "aaa"; - final VirtualPortId virtualPortId = VirtualPortId.portId(vPortIdValue); - assertThat(virtualPortId, is(notNullValue())); - assertThat(virtualPortId.portId(), is(vPortIdValue)); - - } -} diff --git a/framework/src/onos/apps/vtn/vtnrsc/src/test/java/org/onosproject/vtnrsc/floatingip/DefaultFloatingIpTest.java b/framework/src/onos/apps/vtn/vtnrsc/src/test/java/org/onosproject/vtnrsc/floatingip/DefaultFloatingIpTest.java deleted file mode 100644 index d6826f5d..00000000 --- a/framework/src/onos/apps/vtn/vtnrsc/src/test/java/org/onosproject/vtnrsc/floatingip/DefaultFloatingIpTest.java +++ /dev/null @@ -1,125 +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.vtnrsc.floatingip; - -import static org.hamcrest.MatcherAssert.assertThat; -import static org.hamcrest.Matchers.is; -import static org.hamcrest.Matchers.notNullValue; -import static org.onlab.junit.ImmutableClassChecker.assertThatClassIsImmutable; - -import org.junit.Test; -import org.onlab.packet.IpAddress; -import org.onosproject.vtnrsc.DefaultFloatingIp; -import org.onosproject.vtnrsc.FloatingIp; -import org.onosproject.vtnrsc.FloatingIpId; -import org.onosproject.vtnrsc.RouterId; -import org.onosproject.vtnrsc.TenantId; -import org.onosproject.vtnrsc.TenantNetworkId; -import org.onosproject.vtnrsc.VirtualPortId; - -import com.google.common.testing.EqualsTester; - -/** - * Unit tests for DefaultFloatingIp class. - */ -public class DefaultFloatingIpTest { - - private String floatingIpIdStr1 = "5fb63824-4d5c-4b85-9f2f-ebb93c9ce3df"; - private String floatingIpIdStr2 = "fa44f585-fe02-40d3-afe7-d1d7e5782c99"; - private String floatingIpStr = "10.1.1.2"; - private String fixedIpStr = "192.168.1.2"; - private String tenantIdStr = "123"; - private String tenantNetworkId = "1234567"; - private String virtualPortId = "1212"; - private String routerIdStr = "123"; - - /** - * Checks that the DefaultFloatingIp class is immutable. - */ - @Test - public void testImmutability() { - assertThatClassIsImmutable(DefaultFloatingIp.class); - } - - /** - * Checks the operation of equals(). - */ - @Test - public void testEquals() { - final TenantId tenantId = TenantId.tenantId(tenantIdStr); - final TenantNetworkId networkId = TenantNetworkId - .networkId(tenantNetworkId); - final VirtualPortId portId = VirtualPortId.portId(virtualPortId); - final RouterId routerId = RouterId.valueOf(routerIdStr); - final FloatingIpId id1 = FloatingIpId.of(floatingIpIdStr1); - final FloatingIpId id2 = FloatingIpId.of(floatingIpIdStr2); - final IpAddress floatingIpAddress = IpAddress.valueOf(floatingIpStr); - final IpAddress fixedIpAddress = IpAddress.valueOf(fixedIpStr); - - FloatingIp fip1 = new DefaultFloatingIp(id1, tenantId, networkId, - portId, routerId, - floatingIpAddress, - fixedIpAddress, - FloatingIp.Status.ACTIVE); - FloatingIp fip2 = new DefaultFloatingIp(id1, tenantId, networkId, - portId, routerId, - floatingIpAddress, - fixedIpAddress, - FloatingIp.Status.ACTIVE); - FloatingIp fip3 = new DefaultFloatingIp(id2, tenantId, networkId, - portId, routerId, - floatingIpAddress, - fixedIpAddress, - FloatingIp.Status.ACTIVE); - - new EqualsTester().addEqualityGroup(fip1, fip2).addEqualityGroup(fip3) - .testEquals(); - } - - /** - * Checks the construction of a DefaultFloatingIp object. - */ - @Test - public void testConstruction() { - final TenantId tenantId = TenantId.tenantId(tenantIdStr); - final TenantNetworkId networkId = TenantNetworkId - .networkId(tenantNetworkId); - final VirtualPortId portId = VirtualPortId.portId(virtualPortId); - final RouterId routerId = RouterId.valueOf(routerIdStr); - final FloatingIpId id = FloatingIpId.of(floatingIpIdStr1); - final IpAddress floatingIpAddress = IpAddress.valueOf(floatingIpStr); - final IpAddress fixedIpAddress = IpAddress.valueOf(fixedIpStr); - - FloatingIp fip = new DefaultFloatingIp(id, tenantId, networkId, portId, - routerId, floatingIpAddress, - fixedIpAddress, - FloatingIp.Status.ACTIVE); - assertThat(id, is(notNullValue())); - assertThat(id, is(fip.id())); - assertThat(tenantId, is(notNullValue())); - assertThat(tenantId, is(fip.tenantId())); - assertThat(networkId, is(notNullValue())); - assertThat(networkId, is(fip.networkId())); - assertThat(portId, is(notNullValue())); - assertThat(portId, is(fip.portId())); - assertThat(routerId, is(notNullValue())); - assertThat(routerId, is(fip.routerId())); - assertThat(floatingIpAddress, is(notNullValue())); - assertThat(floatingIpAddress, is(fip.floatingIp())); - assertThat(fixedIpAddress, is(notNullValue())); - assertThat(fixedIpAddress, is(fip.fixedIp())); - } -} diff --git a/framework/src/onos/apps/vtn/vtnrsc/src/test/java/org/onosproject/vtnrsc/floatingip/FloatingIpIdTest.java b/framework/src/onos/apps/vtn/vtnrsc/src/test/java/org/onosproject/vtnrsc/floatingip/FloatingIpIdTest.java deleted file mode 100644 index 6ae27e9e..00000000 --- a/framework/src/onos/apps/vtn/vtnrsc/src/test/java/org/onosproject/vtnrsc/floatingip/FloatingIpIdTest.java +++ /dev/null @@ -1,64 +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.vtnrsc.floatingip; - -import static org.hamcrest.MatcherAssert.assertThat; -import static org.hamcrest.Matchers.is; -import static org.hamcrest.Matchers.notNullValue; -import static org.onlab.junit.ImmutableClassChecker.assertThatClassIsImmutable; - -import org.junit.Test; -import org.onosproject.vtnrsc.FloatingIpId; - -import com.google.common.testing.EqualsTester; - -/** - * Unit tests for FloatingIpId class. - */ -public class FloatingIpIdTest { - private String floatingIpIdStr1 = "5fb63824-4d5c-4b85-9f2f-ebb93c9ce3df"; - private String floatingIpIdStr2 = "fa44f585-fe02-40d3-afe7-d1d7e5782c99"; - - /** - * Checks that the FloatingIpId class is immutable. - */ - @Test - public void testImmutability() { - assertThatClassIsImmutable(FloatingIpId.class); - } - - /** - * Checks the operation of equals() methods. - */ - @Test - public void testEquals() { - FloatingIpId id1 = FloatingIpId.of(floatingIpIdStr1); - FloatingIpId id2 = FloatingIpId.of(floatingIpIdStr1); - FloatingIpId id3 = FloatingIpId.of(floatingIpIdStr2); - new EqualsTester().addEqualityGroup(id1, id2).addEqualityGroup(id3) - .testEquals(); - } - - /** - * Checks the construction of a FloatingIpId object. - */ - @Test - public void testConstruction() { - final FloatingIpId id = FloatingIpId.of(floatingIpIdStr1); - assertThat(id, is(notNullValue())); - assertThat(id.floatingIpId().toString(), is(floatingIpIdStr1)); - } -} diff --git a/framework/src/onos/apps/vtn/vtnrsc/src/test/java/org/onosproject/vtnrsc/flowclassifier/impl/FlowClassifierManagerTest.java b/framework/src/onos/apps/vtn/vtnrsc/src/test/java/org/onosproject/vtnrsc/flowclassifier/impl/FlowClassifierManagerTest.java deleted file mode 100644 index 8283a52b..00000000 --- a/framework/src/onos/apps/vtn/vtnrsc/src/test/java/org/onosproject/vtnrsc/flowclassifier/impl/FlowClassifierManagerTest.java +++ /dev/null @@ -1,146 +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.vtnrsc.flowclassifier.impl; - -import static org.hamcrest.MatcherAssert.assertThat; -import static org.hamcrest.Matchers.is; -import static org.hamcrest.Matchers.notNullValue; - -import org.junit.Test; - -import org.onlab.packet.IpPrefix; - -import org.onosproject.vtnrsc.TenantId; -import org.onosproject.vtnrsc.DefaultFlowClassifier; -import org.onosproject.vtnrsc.FlowClassifierId; -import org.onosproject.vtnrsc.VirtualPortId; -import org.onosproject.vtnrsc.FlowClassifier; -import org.onosproject.vtnrsc.util.VtnStorageServiceTest; - -/** - * Unit tests for FlowClassifierManager class. - */ -public class FlowClassifierManagerTest { - - final String name = "FlowClassifier"; - final String description = "FlowClassifier"; - final String ethType = "IPv4"; - final String protocol = "udp"; - final int minSrcPortRange = 1024; - final int maxSrcPortRange = 5000; - final int minDstPortRange = 1024; - final int maxDstPortRange = 5000; - final FlowClassifierId flowClassifierId = FlowClassifierId.of("71111111-fc23-aeb6-f44b-56dc5e2fb3ae"); - final TenantId tenantId = TenantId.tenantId("8"); - final IpPrefix srcIpPrefix = IpPrefix.valueOf("0.0.0.0/0"); - final IpPrefix dstIpPrefix = IpPrefix.valueOf("100.100.100.100/0"); - final VirtualPortId virtualSrcPort = VirtualPortId.portId("100"); - final VirtualPortId virtualDstPort = VirtualPortId.portId("200"); - DefaultFlowClassifier.Builder flowClassifierBuilder = new DefaultFlowClassifier.Builder(); - FlowClassifierManager flowClassifierMgr = new FlowClassifierManager(); - FlowClassifier flowClassifier = null; - private final VtnStorageServiceTest storageService = new VtnStorageServiceTest(); - - /** - * Checks the operation of createFlowClassifier() method. - */ - @Test - public void testCreateFlowClassifier() { - // initialize flow classifier manager - flowClassifierMgr.storageService = storageService; - flowClassifierMgr.activate(); - - // create flow classifier - flowClassifier = flowClassifierBuilder.setFlowClassifierId(flowClassifierId).setTenantId(tenantId) - .setName(name).setDescription(description).setEtherType(ethType).setProtocol(protocol) - .setMinSrcPortRange(minSrcPortRange).setMaxSrcPortRange(maxSrcPortRange) - .setMinDstPortRange(minDstPortRange).setMaxDstPortRange(maxDstPortRange).setSrcIpPrefix(srcIpPrefix) - .setDstIpPrefix(dstIpPrefix).setSrcPort(virtualSrcPort).setDstPort(virtualDstPort).build(); - assertThat(flowClassifierMgr.createFlowClassifier(flowClassifier), is(true)); - } - - /** - * Checks the operation of exists() method. - */ - @Test - public void testExists() { - testCreateFlowClassifier(); - assertThat(flowClassifierMgr.exists(flowClassifierId), is(true)); - } - - /** - * Checks the operation of getFlowClassifierCount() method. - */ - @Test - public void testGetFlowClassifierCount() { - testCreateFlowClassifier(); - assertThat(flowClassifierMgr.getFlowClassifierCount(), is(1)); - } - - /** - * Checks the operation of getFlowClassifiers() method. - */ - @Test - public void testGetFlowClassifiers() { - testCreateFlowClassifier(); - final Iterable<FlowClassifier> flowClassifierList = flowClassifierMgr.getFlowClassifiers(); - assertThat(flowClassifierList, is(notNullValue())); - assertThat(flowClassifierList.iterator().hasNext(), is(true)); - } - - /** - * Checks the operation of getFlowClassifier() method. - */ - @Test - public void testGetFlowClassifier() { - testCreateFlowClassifier(); - assertThat(flowClassifier, is(notNullValue())); - assertThat(flowClassifierMgr.getFlowClassifier(flowClassifierId), is(flowClassifier)); - } - - /** - * Checks the operation of updateFlowClassifier() method. - */ - @Test - public void testUpdateFlowClassifier() { - // create a flow classifier - testCreateFlowClassifier(); - - // new updates - final String name2 = "FlowClassifier2"; - final String description2 = "FlowClassifier2"; - final String ethType2 = "IPv6"; - final String protocol2 = "tcp"; - final TenantId tenantId2 = TenantId.tenantId("10"); - final VirtualPortId virtualSrcPort2 = VirtualPortId.portId("300"); - final VirtualPortId virtualDstPort2 = VirtualPortId.portId("400"); - flowClassifier = flowClassifierBuilder.setFlowClassifierId(flowClassifierId) - .setTenantId(tenantId2).setName(name2).setDescription(description2).setEtherType(ethType2) - .setProtocol(protocol2).setMinSrcPortRange(minSrcPortRange).setMaxSrcPortRange(maxSrcPortRange) - .setMinDstPortRange(minDstPortRange).setMaxDstPortRange(maxDstPortRange).setSrcIpPrefix(srcIpPrefix) - .setDstIpPrefix(dstIpPrefix).setSrcPort(virtualSrcPort2).setDstPort(virtualDstPort2).build(); - assertThat(flowClassifierMgr.updateFlowClassifier(flowClassifier), is(true)); - } - - /** - * Checks the operation of removeFlowClassifier() method. - */ - @Test - public void testRemoveFlowClassifier() { - testCreateFlowClassifier(); - assertThat(flowClassifierMgr.removeFlowClassifier(flowClassifierId), is(true)); - } -} diff --git a/framework/src/onos/apps/vtn/vtnrsc/src/test/java/org/onosproject/vtnrsc/portchain/impl/PortChainManagerTest.java b/framework/src/onos/apps/vtn/vtnrsc/src/test/java/org/onosproject/vtnrsc/portchain/impl/PortChainManagerTest.java deleted file mode 100644 index 0831ec9c..00000000 --- a/framework/src/onos/apps/vtn/vtnrsc/src/test/java/org/onosproject/vtnrsc/portchain/impl/PortChainManagerTest.java +++ /dev/null @@ -1,155 +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.vtnrsc.portchain.impl; - -import static org.hamcrest.MatcherAssert.assertThat; -import static org.hamcrest.Matchers.is; -import static org.hamcrest.Matchers.notNullValue; - -import org.junit.Test; -import java.util.List; -import java.util.LinkedList; - -import org.onosproject.vtnrsc.PortChainId; -import org.onosproject.vtnrsc.PortPairGroupId; -import org.onosproject.vtnrsc.TenantId; -import org.onosproject.vtnrsc.FlowClassifierId; -import org.onosproject.vtnrsc.PortChain; -import org.onosproject.vtnrsc.DefaultPortChain; -import org.onosproject.vtnrsc.DefaultFlowClassifier; -import org.onosproject.vtnrsc.util.VtnStorageServiceTest; - -/** - * Unit tests for PortChainManager class. - */ -public class PortChainManagerTest { - final PortChainId portChainId = PortChainId.of("78888888-fc23-aeb6-f44b-56dc5e2fb3ae"); - final TenantId tenantId = TenantId.tenantId("1"); - final String name = "PortChain"; - final String description = "PortChain"; - final List<PortPairGroupId> portPairGroupList = new LinkedList<PortPairGroupId>(); - final List<FlowClassifierId> flowClassifierList = new LinkedList<FlowClassifierId>(); - DefaultPortChain.Builder portChainBuilder = new DefaultPortChain.Builder(); - DefaultFlowClassifier.Builder flowClassifierBuilder = new DefaultFlowClassifier.Builder(); - PortChainManager portChainMgr = new PortChainManager(); - PortChain portChain = null; - private final VtnStorageServiceTest storageService = new VtnStorageServiceTest(); - - /** - * Checks the operation of createPortChain() method. - */ - @Test - public void testCreatePortChain() { - // initialize port chain manager - portChainMgr.storageService = storageService; - portChainMgr.activate(); - - // create list of Port Pair Groups. - PortPairGroupId portPairGroupId = PortPairGroupId.of("73333333-fc23-aeb6-f44b-56dc5e2fb3ae"); - portPairGroupList.add(portPairGroupId); - portPairGroupId = PortPairGroupId.of("73333333-fc23-aeb6-f44b-56dc5e2fb3af"); - portPairGroupList.add(portPairGroupId); - - // create list of Flow classifiers. - FlowClassifierId flowClassifierId = FlowClassifierId.of("74444444-fc23-aeb6-f44b-56dc5e2fb3ae"); - flowClassifierList.add(flowClassifierId); - flowClassifierId = FlowClassifierId.of("74444444-fc23-aeb6-f44b-56dc5e2fb3af"); - flowClassifierList.add(flowClassifierId); - - // create port chain - portChain = portChainBuilder.setId(portChainId).setTenantId(tenantId).setName(name).setDescription(description) - .setPortPairGroups(portPairGroupList).setFlowClassifiers(flowClassifierList).build(); - assertThat(portChainMgr.createPortChain(portChain), is(true)); - } - - /** - * Checks the operation of exists() method. - */ - @Test - public void testExists() { - testCreatePortChain(); - assertThat(portChainMgr.exists(portChainId), is(true)); - } - - /** - * Checks the operation of getPortChainCount() method. - */ - @Test - public void testGetPortChainCount() { - testCreatePortChain(); - assertThat(portChainMgr.getPortChainCount(), is(1)); - } - - /** - * Checks the operation of getPortChains() method. - */ - @Test - public void testGetPortChains() { - testCreatePortChain(); - final Iterable<PortChain> portChainList = portChainMgr.getPortChains(); - assertThat(portChainList, is(notNullValue())); - assertThat(portChainList.iterator().hasNext(), is(true)); - } - - /** - * Checks the operation of getPortChain() method. - */ - @Test - public void testGetPortChain() { - testCreatePortChain(); - assertThat(portChain, is(notNullValue())); - assertThat(portChainMgr.getPortChain(portChainId), is(portChain)); - } - - /** - * Checks the operation of updatePortChain() method. - */ - @Test - public void testUpdatePortChain() { - // create a port chain - testCreatePortChain(); - - // new updates - final TenantId tenantId2 = TenantId.tenantId("2"); - final String name2 = "PortChain2"; - final String description2 = "PortChain2"; - // create list of Port Pair Groups. - final List<PortPairGroupId> portPairGroupList = new LinkedList<PortPairGroupId>(); - PortPairGroupId portPairGroupId = PortPairGroupId.of("75555555-fc23-aeb6-f44b-56dc5e2fb3ae"); - portPairGroupList.add(portPairGroupId); - portPairGroupId = PortPairGroupId.of("75555555-fc23-aeb6-f44b-56dc5e2fb3af"); - portPairGroupList.add(portPairGroupId); - // create list of Flow classifiers. - final List<FlowClassifierId> flowClassifierList = new LinkedList<FlowClassifierId>(); - FlowClassifierId flowClassifierId = FlowClassifierId.of("76666666-fc23-aeb6-f44b-56dc5e2fb3ae"); - flowClassifierList.add(flowClassifierId); - flowClassifierId = FlowClassifierId.of("76666666-fc23-aeb6-f44b-56dc5e2fb3af"); - flowClassifierList.add(flowClassifierId); - portChain = portChainBuilder.setId(portChainId).setTenantId(tenantId2).setName(name2) - .setDescription(description2).setPortPairGroups(portPairGroupList) - .setFlowClassifiers(flowClassifierList).build(); - assertThat(portChainMgr.updatePortChain(portChain), is(true)); - } - - /** - * Checks the operation of removePortChain() method. - */ - @Test - public void testRemovePortChain() { - testCreatePortChain(); - assertThat(portChainMgr.removePortChain(portChainId), is(true)); - } -} diff --git a/framework/src/onos/apps/vtn/vtnrsc/src/test/java/org/onosproject/vtnrsc/portpair/impl/PortPairManagerTest.java b/framework/src/onos/apps/vtn/vtnrsc/src/test/java/org/onosproject/vtnrsc/portpair/impl/PortPairManagerTest.java deleted file mode 100644 index c936d7cc..00000000 --- a/framework/src/onos/apps/vtn/vtnrsc/src/test/java/org/onosproject/vtnrsc/portpair/impl/PortPairManagerTest.java +++ /dev/null @@ -1,126 +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.vtnrsc.portpair.impl; - -import static org.hamcrest.MatcherAssert.assertThat; -import static org.hamcrest.Matchers.is; -import static org.hamcrest.Matchers.notNullValue; - -import org.junit.Test; - -import org.onosproject.vtnrsc.PortPair; -import org.onosproject.vtnrsc.PortPairId; -import org.onosproject.vtnrsc.TenantId; -import org.onosproject.vtnrsc.DefaultPortPair; -import org.onosproject.vtnrsc.util.VtnStorageServiceTest; - -/** - * Unit tests for PortPairManager class. - */ -public class PortPairManagerTest { - final PortPairId portPairId = PortPairId.of("78888888-fc23-aeb6-f44b-56dc5e2fb3ae"); - final TenantId tenantId = TenantId.tenantId("1"); - final String name = "PortPair"; - final String description = "PortPair"; - final String ingress = "d3333333-24fc-4fae-af4b-321c5e2eb3d1"; - final String egress = "a4444444-4a56-2a6e-cd3a-9dee4e2ec345"; - DefaultPortPair.Builder portPairBuilder = new DefaultPortPair.Builder(); - PortPairManager portPairMgr = new PortPairManager(); - PortPair portPair = null; - private final VtnStorageServiceTest storageService = new VtnStorageServiceTest(); - - /** - * Checks the operation of createPortPair() method. - */ - @Test - public void testCreatePortPair() { - // initialize port pair manager - portPairMgr.storageService = storageService; - portPairMgr.activate(); - - // create port pair - portPair = portPairBuilder.setId(portPairId).setTenantId(tenantId).setName(name) - .setDescription(description).setIngress(ingress).setEgress(egress).build(); - assertThat(portPairMgr.createPortPair(portPair), is(true)); - } - - /** - * Checks the operation of exists() method. - */ - @Test - public void testExists() { - testCreatePortPair(); - assertThat(portPairMgr.exists(portPairId), is(true)); - } - - /** - * Checks the operation of getPortPairCount() method. - */ - @Test - public void testGetPortPairCount() { - testCreatePortPair(); - assertThat(portPairMgr.getPortPairCount(), is(1)); - } - - /** - * Checks the operation of getPortPairs() method. - */ - @Test - public void testGetPortPairs() { - testCreatePortPair(); - final Iterable<PortPair> portPairList = portPairMgr.getPortPairs(); - assertThat(portPairList, is(notNullValue())); - assertThat(portPairList.iterator().hasNext(), is(true)); - } - - /** - * Checks the operation of getPortPair() method. - */ - @Test - public void testGetPortPair() { - testCreatePortPair(); - assertThat(portPair, is(notNullValue())); - assertThat(portPairMgr.getPortPair(portPairId), is(portPair)); - } - - /** - * Checks the operation of updatePortPair() method. - */ - @Test - public void testUpdatePortPair() { - // create a port pair - testCreatePortPair(); - - // new updates - final TenantId tenantId2 = TenantId.tenantId("2"); - final String name2 = "PortPair2"; - final String description2 = "PortPair2"; - final String ingress2 = "d5555555-24fc-4fae-af4b-321c5e2eb3d1"; - final String egress2 = "a6666666-4a56-2a6e-cd3a-9dee4e2ec345"; - portPair = portPairBuilder.setId(portPairId).setTenantId(tenantId2).setName(name2) - .setDescription(description2).setIngress(ingress2).setEgress(egress2).build(); - assertThat(portPairMgr.updatePortPair(portPair), is(true)); - } - - /** - * Checks the operation of removePortPair() method. - */ - @Test - public void testRemovePortPair() { - testCreatePortPair(); - assertThat(portPairMgr.removePortPair(portPairId), is(true)); - } -} diff --git a/framework/src/onos/apps/vtn/vtnrsc/src/test/java/org/onosproject/vtnrsc/portpairgroup/impl/PortPairGroupManagerTest.java b/framework/src/onos/apps/vtn/vtnrsc/src/test/java/org/onosproject/vtnrsc/portpairgroup/impl/PortPairGroupManagerTest.java deleted file mode 100644 index 95bcd09a..00000000 --- a/framework/src/onos/apps/vtn/vtnrsc/src/test/java/org/onosproject/vtnrsc/portpairgroup/impl/PortPairGroupManagerTest.java +++ /dev/null @@ -1,140 +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.vtnrsc.portpairgroup.impl; - -import static org.hamcrest.MatcherAssert.assertThat; -import static org.hamcrest.Matchers.is; -import static org.hamcrest.Matchers.notNullValue; - -import org.junit.Test; -import java.util.List; -import java.util.LinkedList; - -import org.onosproject.vtnrsc.PortPairId; -import org.onosproject.vtnrsc.PortPairGroup; -import org.onosproject.vtnrsc.PortPairGroupId; -import org.onosproject.vtnrsc.TenantId; -import org.onosproject.vtnrsc.DefaultPortPairGroup; -import org.onosproject.vtnrsc.util.VtnStorageServiceTest; - -/** - * Unit tests for PortPairGroupManager class. - */ -public class PortPairGroupManagerTest { - final PortPairGroupId portPairGroupId = PortPairGroupId.of("78888888-fc23-aeb6-f44b-56dc5e2fb3ae"); - final TenantId tenantId = TenantId.tenantId("1"); - final String name = "PortPairGroup"; - final String description = "PortPairGroup"; - final List<PortPairId> portPairIdList = new LinkedList<PortPairId>(); - DefaultPortPairGroup.Builder portPairGroupBuilder = new DefaultPortPairGroup.Builder(); - PortPairGroupManager portPairGroupMgr = new PortPairGroupManager(); - PortPairGroup portPairGroup = null; - private final VtnStorageServiceTest storageService = new VtnStorageServiceTest(); - - /** - * Checks the operation of createPortPairGroup() method. - */ - @Test - public void testCreatePortPairGroup() { - // initialize port pair group manager - portPairGroupMgr.storageService = storageService; - portPairGroupMgr.activate(); - - // create port-pair-id list - PortPairId portPairId = PortPairId.of("73333333-fc23-aeb6-f44b-56dc5e2fb3ae"); - portPairIdList.add(portPairId); - portPairId = PortPairId.of("74444444-fc23-aeb6-f44b-56dc5e2fb3ae"); - portPairIdList.add(portPairId); - - // create port pair - portPairGroup = portPairGroupBuilder.setId(portPairGroupId).setTenantId(tenantId).setName(name) - .setDescription(description).setPortPairs(portPairIdList).build(); - assertThat(portPairGroupMgr.createPortPairGroup(portPairGroup), is(true)); - } - - /** - * Checks the operation of exists() method. - */ - @Test - public void testExists() { - testCreatePortPairGroup(); - assertThat(portPairGroupMgr.exists(portPairGroupId), is(true)); - } - - /** - * Checks the operation of getPortPairGroupCount() method. - */ - @Test - public void testGetPortPairGroupCount() { - testCreatePortPairGroup(); - assertThat(portPairGroupMgr.getPortPairGroupCount(), is(1)); - } - - /** - * Checks the operation of getPortPairGroups() method. - */ - @Test - public void testGetPortPairGroups() { - testCreatePortPairGroup(); - final Iterable<PortPairGroup> portPairGroupList = portPairGroupMgr.getPortPairGroups(); - assertThat(portPairGroupList, is(notNullValue())); - assertThat(portPairGroupList.iterator().hasNext(), is(true)); - } - - /** - * Checks the operation of getPortPairGroup() method. - */ - @Test - public void testGetPortPairGroup() { - testCreatePortPairGroup(); - assertThat(portPairGroup, is(notNullValue())); - assertThat(portPairGroupMgr.getPortPairGroup(portPairGroupId), is(portPairGroup)); - } - - /** - * Checks the operation of updatePortPairGroup() method. - */ - @Test - public void testUpdatePortPairGroup() { - // create a port pair group - testCreatePortPairGroup(); - - // new updates - // create port-pair-id list - final TenantId tenantId2 = TenantId.tenantId("2"); - final String name2 = "PortPairGroup2"; - final String description2 = "PortPairGroup2"; - final List<PortPairId> portPairIdList = new LinkedList<PortPairId>(); - PortPairId portPairId = PortPairId.of("75555555-fc23-aeb6-f44b-56dc5e2fb3ae"); - portPairIdList.add(portPairId); - portPairId = PortPairId.of("76666666-fc23-aeb6-f44b-56dc5e2fb3ae"); - portPairIdList.add(portPairId); - - // create port pair - portPairGroup = portPairGroupBuilder.setId(portPairGroupId).setTenantId(tenantId2).setName(name2) - .setDescription(description2).setPortPairs(portPairIdList).build(); - assertThat(portPairGroupMgr.updatePortPairGroup(portPairGroup), is(true)); - } - - /** - * Checks the operation of removePortPairGroup() method. - */ - @Test - public void testRemovePortPairGroup() { - testCreatePortPairGroup(); - assertThat(portPairGroupMgr.removePortPairGroup(portPairGroupId), is(true)); - } -} diff --git a/framework/src/onos/apps/vtn/vtnrsc/src/test/java/org/onosproject/vtnrsc/router/DefaultRouterTest.java b/framework/src/onos/apps/vtn/vtnrsc/src/test/java/org/onosproject/vtnrsc/router/DefaultRouterTest.java deleted file mode 100644 index ecc80658..00000000 --- a/framework/src/onos/apps/vtn/vtnrsc/src/test/java/org/onosproject/vtnrsc/router/DefaultRouterTest.java +++ /dev/null @@ -1,114 +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.vtnrsc.router; - -import static org.hamcrest.MatcherAssert.assertThat; -import static org.hamcrest.Matchers.is; -import static org.hamcrest.Matchers.notNullValue; -import static org.onlab.junit.ImmutableClassChecker.assertThatClassIsImmutable; - -import java.util.Collections; - -import org.junit.Test; -import org.onosproject.vtnrsc.DefaultRouter; -import org.onosproject.vtnrsc.Router; -import org.onosproject.vtnrsc.RouterGateway; -import org.onosproject.vtnrsc.RouterId; -import org.onosproject.vtnrsc.TenantId; -import org.onosproject.vtnrsc.TenantNetworkId; -import org.onosproject.vtnrsc.VirtualPortId; - -import com.google.common.testing.EqualsTester; - -/** - * Unit tests for DefaultRouter class. - */ -public class DefaultRouterTest { - - private String tenantIdStr = "123"; - private String virtualPortId = "1212"; - private String routeIdStr1 = "1"; - private String routeIdStr2 = "2"; - private String routerName = "router"; - private String tenantNetworkId = "1234567"; - - /** - * Checks that the DefaultRouter class is immutable. - */ - @Test - public void testImmutability() { - assertThatClassIsImmutable(DefaultRouter.class); - } - - /** - * Checks the operation of equals(). - */ - @Test - public void testEquals() { - final TenantId tenantId = TenantId.tenantId(tenantIdStr); - final VirtualPortId portId = VirtualPortId.portId(virtualPortId); - final RouterId routerId1 = RouterId.valueOf(routeIdStr1); - final RouterId routerId2 = RouterId.valueOf(routeIdStr2); - final TenantNetworkId networkId = TenantNetworkId - .networkId(tenantNetworkId); - final RouterGateway routerGateway = RouterGateway.routerGateway( - networkId, - true, - Collections - .emptySet()); - - Router r1 = new DefaultRouter(routerId1, routerName, false, - Router.Status.ACTIVE, false, - routerGateway, portId, tenantId, null); - Router r2 = new DefaultRouter(routerId1, routerName, false, - Router.Status.ACTIVE, false, - routerGateway, portId, tenantId, null); - Router r3 = new DefaultRouter(routerId2, routerName, false, - Router.Status.ACTIVE, false, - routerGateway, portId, tenantId, null); - - new EqualsTester().addEqualityGroup(r1, r2).addEqualityGroup(r3) - .testEquals(); - } - - /** - * Checks the construction of a DefaultRouter object. - */ - @Test - public void testConstruction() { - final TenantId tenantId = TenantId.tenantId(tenantIdStr); - final VirtualPortId portId = VirtualPortId.portId(virtualPortId); - final RouterId routerId = RouterId.valueOf(routeIdStr1); - final TenantNetworkId networkId = TenantNetworkId - .networkId(tenantNetworkId); - final RouterGateway routerGateway = RouterGateway.routerGateway( - networkId, - true, - Collections - .emptySet()); - - Router r1 = new DefaultRouter(routerId, routerName, false, - Router.Status.ACTIVE, false, - routerGateway, portId, tenantId, null); - assertThat(routerId, is(notNullValue())); - assertThat(routerId, is(r1.id())); - assertThat(tenantId, is(notNullValue())); - assertThat(tenantId, is(r1.tenantId())); - assertThat(routerGateway, is(notNullValue())); - assertThat(routerGateway, is(r1.externalGatewayInfo())); - } - -} diff --git a/framework/src/onos/apps/vtn/vtnrsc/src/test/java/org/onosproject/vtnrsc/router/RouterInterfaceTest.java b/framework/src/onos/apps/vtn/vtnrsc/src/test/java/org/onosproject/vtnrsc/router/RouterInterfaceTest.java deleted file mode 100644 index 53ea037d..00000000 --- a/framework/src/onos/apps/vtn/vtnrsc/src/test/java/org/onosproject/vtnrsc/router/RouterInterfaceTest.java +++ /dev/null @@ -1,97 +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.vtnrsc.router; - -import static org.hamcrest.MatcherAssert.assertThat; -import static org.hamcrest.Matchers.is; -import static org.hamcrest.Matchers.notNullValue; -import static org.onlab.junit.ImmutableClassChecker.assertThatClassIsImmutable; - -import org.junit.Test; -import org.onosproject.vtnrsc.RouterId; -import org.onosproject.vtnrsc.RouterInterface; -import org.onosproject.vtnrsc.SubnetId; -import org.onosproject.vtnrsc.TenantId; -import org.onosproject.vtnrsc.VirtualPortId; - -import com.google.common.testing.EqualsTester; - -/** - * Unit tests for RouterInterface class. - */ -public class RouterInterfaceTest { - private String tenantIdStr = "123"; - private String virtualPortId = "1212"; - private String routeIdStr1 = "1"; - private String routeIdStr2 = "2"; - private String subnetIdStr = "1234567"; - - /** - * Checks that the RouterInterface class is immutable. - */ - @Test - public void testImmutability() { - assertThatClassIsImmutable(RouterInterface.class); - } - - /** - * Checks the operation of equals(). - */ - @Test - public void testEquals() { - final TenantId tenantId = TenantId.tenantId(tenantIdStr); - final VirtualPortId portId = VirtualPortId.portId(virtualPortId); - final RouterId routerId1 = RouterId.valueOf(routeIdStr1); - final RouterId routerId2 = RouterId.valueOf(routeIdStr2); - final SubnetId subnet = SubnetId.subnetId(subnetIdStr); - - RouterInterface ri1 = RouterInterface.routerInterface(subnet, portId, - routerId1, - tenantId); - RouterInterface ri2 = RouterInterface.routerInterface(subnet, portId, - routerId1, - tenantId); - RouterInterface ri3 = RouterInterface.routerInterface(subnet, portId, - routerId2, - tenantId); - - new EqualsTester().addEqualityGroup(ri1, ri2).addEqualityGroup(ri3) - .testEquals(); - } - - /** - * Checks the construction of a RouterInterface object. - */ - @Test - public void testConstruction() { - final TenantId tenantId = TenantId.tenantId(tenantIdStr); - final VirtualPortId portId = VirtualPortId.portId(virtualPortId); - final RouterId routerId1 = RouterId.valueOf(routeIdStr1); - final SubnetId subnet = SubnetId.subnetId(subnetIdStr); - - RouterInterface ri1 = RouterInterface.routerInterface(subnet, portId, - routerId1, - tenantId); - assertThat(portId, is(notNullValue())); - assertThat(portId, is(ri1.portId())); - assertThat(tenantId, is(notNullValue())); - assertThat(tenantId, is(ri1.tenantId())); - assertThat(routerId1, is(notNullValue())); - assertThat(routerId1, is(ri1.routerId())); - assertThat(subnet, is(notNullValue())); - assertThat(subnet, is(ri1.subnetId())); - } -} diff --git a/framework/src/onos/apps/vtn/vtnrsc/src/test/java/org/onosproject/vtnrsc/util/VtnEventuallyConsistentMapAdapter.java b/framework/src/onos/apps/vtn/vtnrsc/src/test/java/org/onosproject/vtnrsc/util/VtnEventuallyConsistentMapAdapter.java deleted file mode 100644 index 0631f865..00000000 --- a/framework/src/onos/apps/vtn/vtnrsc/src/test/java/org/onosproject/vtnrsc/util/VtnEventuallyConsistentMapAdapter.java +++ /dev/null @@ -1,114 +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.vtnrsc.util;
-
-import java.util.Collection;
-import java.util.Map;
-import java.util.Set;
-import java.util.function.BiFunction;
-
-import org.onosproject.store.service.EventuallyConsistentMap;
-import org.onosproject.store.service.EventuallyConsistentMapListener;
-
-/**
- * Testing adapter for EventuallyConsistentMap.
- */
-public class VtnEventuallyConsistentMapAdapter<K, V> implements EventuallyConsistentMap<K, V> {
- @Override
- public int size() {
- return 0;
- }
-
- @Override
- public boolean isEmpty() {
- return false;
- }
-
- @Override
- public boolean containsKey(K key) {
- return false;
- }
-
- @Override
- public boolean containsValue(V value) {
- return false;
- }
-
- @Override
- public V get(K key) {
- return null;
- }
-
- @Override
- public void put(K key, V value) {
-
- }
-
- @Override
- public V remove(K key) {
- return null;
- }
-
- @Override
- public void remove(K key, V value) {
-
- }
-
- @Override
- public V compute(K key, BiFunction<K, V, V> recomputeFunction) {
- return null;
- }
-
- @Override
- public void putAll(Map<? extends K, ? extends V> m) {
-
- }
-
- @Override
- public void clear() {
-
- }
-
- @Override
- public Set<K> keySet() {
- return null;
- }
-
- @Override
- public Collection<V> values() {
- return null;
- }
-
- @Override
- public Set<Map.Entry<K, V>> entrySet() {
- return null;
- }
-
- @Override
- public void addListener(EventuallyConsistentMapListener<K, V> listener) {
-
- }
-
- @Override
- public void removeListener(EventuallyConsistentMapListener<K, V> listener) {
-
- }
-
- @Override
- public void destroy() {
-
- }
-}
diff --git a/framework/src/onos/apps/vtn/vtnrsc/src/test/java/org/onosproject/vtnrsc/util/VtnEventuallyConsistentMapTest.java b/framework/src/onos/apps/vtn/vtnrsc/src/test/java/org/onosproject/vtnrsc/util/VtnEventuallyConsistentMapTest.java deleted file mode 100644 index 68b7d689..00000000 --- a/framework/src/onos/apps/vtn/vtnrsc/src/test/java/org/onosproject/vtnrsc/util/VtnEventuallyConsistentMapTest.java +++ /dev/null @@ -1,242 +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.vtnrsc.util;
-
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.ScheduledExecutorService;
-import java.util.concurrent.TimeUnit;
-import java.util.function.BiFunction;
-
-import org.onlab.util.KryoNamespace;
-import org.onosproject.cluster.NodeId;
-import org.onosproject.store.Timestamp;
-
-import static org.onosproject.store.service.EventuallyConsistentMapEvent.Type.*;
-import org.onosproject.store.service.EventuallyConsistentMapListener;
-import org.onosproject.store.service.EventuallyConsistentMapEvent;
-import org.onosproject.store.service.EventuallyConsistentMapBuilder;
-import org.onosproject.store.service.EventuallyConsistentMap;
-
-/**
- * Testing version of an Eventually Consistent Map.
- */
-
-public final class VtnEventuallyConsistentMapTest<K, V> extends VtnEventuallyConsistentMapAdapter<K, V> {
-
- private final HashMap<K, V> map;
- private final String mapName;
- private final List<EventuallyConsistentMapListener<K, V>> listeners;
- private final BiFunction<K, V, Collection<NodeId>> peerUpdateFunction;
-
- private VtnEventuallyConsistentMapTest(String mapName,
- BiFunction<K, V, Collection<NodeId>> peerUpdateFunction) {
- map = new HashMap<>();
- listeners = new LinkedList<>();
- this.mapName = mapName;
- this.peerUpdateFunction = peerUpdateFunction;
- }
-
- /**
- * Notify all listeners of an event.
- */
- private void notifyListeners(EventuallyConsistentMapEvent<K, V> event) {
- listeners.forEach(
- listener -> listener.event(event)
- );
- }
-
- @Override
- public int size() {
- return map.size();
- }
-
- @Override
- public boolean isEmpty() {
- return map.isEmpty();
- }
-
- @Override
- public boolean containsKey(K key) {
- return map.containsKey(key);
- }
-
- @Override
- public boolean containsValue(V value) {
- return map.containsValue(value);
- }
-
- @Override
- public V get(K key) {
- return map.get(key);
- }
-
- @Override
- public void put(K key, V value) {
- map.put(key, value);
- EventuallyConsistentMapEvent<K, V> addEvent =
- new EventuallyConsistentMapEvent<>(mapName, PUT, key, value);
- notifyListeners(addEvent);
- if (peerUpdateFunction != null) {
- peerUpdateFunction.apply(key, value);
- }
- }
-
- @Override
- public V remove(K key) {
- V result = map.remove(key);
- if (result != null) {
- EventuallyConsistentMapEvent<K, V> removeEvent =
- new EventuallyConsistentMapEvent<>(mapName, REMOVE,
- key, map.get(key));
- notifyListeners(removeEvent);
- }
- return result;
- }
-
- @Override
- public void remove(K key, V value) {
- boolean removed = map.remove(key, value);
- if (removed) {
- EventuallyConsistentMapEvent<K, V> removeEvent =
- new EventuallyConsistentMapEvent<>(mapName, REMOVE, key, value);
- notifyListeners(removeEvent);
- }
- }
-
- @Override
- public V compute(K key, BiFunction<K, V, V> recomputeFunction) {
- return map.compute(key, recomputeFunction);
- }
-
- @Override
- public void putAll(Map<? extends K, ? extends V> m) {
- map.putAll(m);
- }
-
- @Override
- public void clear() {
- map.clear();
- }
-
- @Override
- public Set<K> keySet() {
- return map.keySet();
- }
-
- @Override
- public Collection<V> values() {
- return map.values();
- }
-
- @Override
- public Set<Map.Entry<K, V>> entrySet() {
- return map.entrySet();
- }
-
- public static <K, V> Builder<K, V> builder() {
- return new Builder<>();
- }
-
- @Override
- public void addListener(EventuallyConsistentMapListener<K, V> listener) {
- listeners.add(listener);
- }
-
- @Override
- public void removeListener(EventuallyConsistentMapListener<K, V> listener) {
- listeners.remove(listener);
- }
-
- public static class Builder<K, V> implements EventuallyConsistentMapBuilder<K, V> {
- private String name;
- private BiFunction<K, V, Collection<NodeId>> peerUpdateFunction;
-
- @Override
- public EventuallyConsistentMapBuilder<K, V> withName(String name) {
- this.name = name;
- return this;
- }
-
- @Override
- public EventuallyConsistentMapBuilder<K, V> withSerializer(KryoNamespace.Builder serializerBuilder) {
- return this;
- }
-
- @Override
- public EventuallyConsistentMapBuilder<K, V>
- withTimestampProvider(BiFunction<K, V, Timestamp> timestampProvider) {
- return this;
- }
-
- @Override
- public EventuallyConsistentMapBuilder<K, V> withEventExecutor(ExecutorService executor) {
- return this;
- }
-
- @Override
- public EventuallyConsistentMapBuilder<K, V> withCommunicationExecutor(ExecutorService executor) {
- return this;
- }
-
- @Override
- public EventuallyConsistentMapBuilder<K, V> withBackgroundExecutor(ScheduledExecutorService executor) {
- return this;
- }
-
- @Override
- public EventuallyConsistentMapBuilder<K, V>
- withPeerUpdateFunction(BiFunction<K, V, Collection<NodeId>> peerUpdateFunction) {
- this.peerUpdateFunction = peerUpdateFunction;
- return this;
- }
-
- @Override
- public EventuallyConsistentMapBuilder<K, V> withTombstonesDisabled() {
- return this;
- }
-
- @Override
- public EventuallyConsistentMapBuilder<K, V> withAntiEntropyPeriod(long period, TimeUnit unit) {
- return this;
- }
-
- @Override
- public EventuallyConsistentMapBuilder<K, V> withFasterConvergence() {
- return this;
- }
-
- @Override
- public EventuallyConsistentMapBuilder<K, V> withPersistence() {
- return this;
- }
-
- @Override
- public EventuallyConsistentMap<K, V> build() {
- if (name == null) {
- name = "test";
- }
- return new VtnEventuallyConsistentMapTest<>(name, peerUpdateFunction);
- }
- }
-
-}
-
diff --git a/framework/src/onos/apps/vtn/vtnrsc/src/test/java/org/onosproject/vtnrsc/util/VtnStorageServiceAdapter.java b/framework/src/onos/apps/vtn/vtnrsc/src/test/java/org/onosproject/vtnrsc/util/VtnStorageServiceAdapter.java deleted file mode 100644 index efb1a791..00000000 --- a/framework/src/onos/apps/vtn/vtnrsc/src/test/java/org/onosproject/vtnrsc/util/VtnStorageServiceAdapter.java +++ /dev/null @@ -1,65 +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.vtnrsc.util;
-
-import org.onosproject.store.service.EventuallyConsistentMapBuilder;
-import org.onosproject.store.service.ConsistentMapBuilder;
-import org.onosproject.store.service.DistributedSetBuilder;
-import org.onosproject.store.service.DistributedQueueBuilder;
-import org.onosproject.store.service.AtomicCounterBuilder;
-import org.onosproject.store.service.AtomicValueBuilder;
-import org.onosproject.store.service.TransactionContextBuilder;
-import org.onosproject.store.service.StorageService;
-
-/**
- * Adapter for the storage service.
- */
-public class VtnStorageServiceAdapter implements StorageService {
- @Override
- public <K, V> EventuallyConsistentMapBuilder<K, V> eventuallyConsistentMapBuilder() {
- return null;
- }
-
- @Override
- public <K, V> ConsistentMapBuilder<K, V> consistentMapBuilder() {
- return null;
- }
-
- @Override
- public <E> DistributedSetBuilder<E> setBuilder() {
- return null;
- }
-
- @Override
- public <E> DistributedQueueBuilder<E> queueBuilder() {
- return null;
- }
-
- @Override
- public AtomicCounterBuilder atomicCounterBuilder() {
- return null;
- }
-
- @Override
- public <V> AtomicValueBuilder<V> atomicValueBuilder() {
- return null;
- }
-
- @Override
- public TransactionContextBuilder transactionContextBuilder() {
- return null;
- }
-}
diff --git a/framework/src/onos/apps/vtn/vtnrsc/src/test/java/org/onosproject/vtnrsc/util/VtnStorageServiceTest.java b/framework/src/onos/apps/vtn/vtnrsc/src/test/java/org/onosproject/vtnrsc/util/VtnStorageServiceTest.java deleted file mode 100644 index 1f0f1835..00000000 --- a/framework/src/onos/apps/vtn/vtnrsc/src/test/java/org/onosproject/vtnrsc/util/VtnStorageServiceTest.java +++ /dev/null @@ -1,25 +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.vtnrsc.util;
-
-import org.onosproject.store.service.EventuallyConsistentMapBuilder;
-
-public class VtnStorageServiceTest extends VtnStorageServiceAdapter {
- @Override
- public <K, V> EventuallyConsistentMapBuilder<K, V> eventuallyConsistentMapBuilder() {
- return VtnEventuallyConsistentMapTest.builder();
- }
-}
|