aboutsummaryrefslogtreecommitdiffstats
path: root/framework/src/onos/apps/vtn/vtnrsc/src
diff options
context:
space:
mode:
Diffstat (limited to 'framework/src/onos/apps/vtn/vtnrsc/src')
-rw-r--r--framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/BindingHostId.java2
-rw-r--r--framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/DefaultFlowClassifier.java16
-rw-r--r--framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/FlowClassifierId.java7
-rw-r--r--framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/PhysicalNetwork.java2
-rw-r--r--framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/PortChainId.java22
-rw-r--r--framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/PortPairGroupId.java23
-rw-r--r--framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/PortPairId.java20
-rw-r--r--framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/Router.java102
-rw-r--r--framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/RouterGateway.java108
-rw-r--r--framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/RouterId.java77
-rw-r--r--framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/SecurityGroup.java2
-rw-r--r--framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/SegmentationId.java2
-rw-r--r--framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/SubnetId.java2
-rw-r--r--framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/TenantId.java2
-rw-r--r--framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/TenantNetworkId.java2
-rw-r--r--framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/VirtualPortId.java2
-rw-r--r--framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/flowclassifier/FlowClassifierService.java (renamed from framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/flowClassifier/FlowClassifierService.java)4
-rw-r--r--framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/flowclassifier/impl/FlowClassifierManager.java (renamed from framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/flowClassifier/impl/FlowClassifierManager.java)38
-rw-r--r--framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/flowclassifier/impl/package-info.java (renamed from framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/flowClassifier/impl/package-info.java)2
-rw-r--r--framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/flowclassifier/package-info.java (renamed from framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/flowClassifier/package-info.java)2
-rw-r--r--framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/portchain/impl/PortChainManager.java146
-rw-r--r--framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/portchain/impl/package-info.java20
-rw-r--r--framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/portpair/PortPairService.java80
-rw-r--r--framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/portpair/impl/PortPairManager.java146
-rw-r--r--framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/portpair/impl/package-info.java20
-rw-r--r--framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/portpair/package-info.java (renamed from framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/web/package-info.java)4
-rw-r--r--framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/portpairgroup/impl/PortPairGroupManager.java146
-rw-r--r--framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/portpairgroup/impl/package-info.java20
-rw-r--r--framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/web/FlowClassifierCodec.java134
-rw-r--r--framework/src/onos/apps/vtn/vtnrsc/src/test/java/org/onosproject/vtnrsc/flowclassifier/FlowClassifierIdTest.java68
-rw-r--r--framework/src/onos/apps/vtn/vtnrsc/src/test/java/org/onosproject/vtnrsc/subnet/DefaultAllocationPoolTest.java68
-rw-r--r--framework/src/onos/apps/vtn/vtnrsc/src/test/java/org/onosproject/vtnrsc/subnet/DefaultHostRouteTest.java68
-rw-r--r--framework/src/onos/apps/vtn/vtnrsc/src/test/java/org/onosproject/vtnrsc/subnet/SubnetIdTest.java64
-rw-r--r--framework/src/onos/apps/vtn/vtnrsc/src/test/java/org/onosproject/vtnrsc/tenantnetwork/DefaultNeutronNetworkTest.java83
-rw-r--r--framework/src/onos/apps/vtn/vtnrsc/src/test/java/org/onosproject/vtnrsc/tenantnetwork/PhysicalNetworkTest.java65
-rw-r--r--framework/src/onos/apps/vtn/vtnrsc/src/test/java/org/onosproject/vtnrsc/tenantnetwork/SegmentationIdTest.java64
-rw-r--r--framework/src/onos/apps/vtn/vtnrsc/src/test/java/org/onosproject/vtnrsc/tenantnetwork/TenantIdTest.java64
-rw-r--r--framework/src/onos/apps/vtn/vtnrsc/src/test/java/org/onosproject/vtnrsc/tenantnetwork/TenantNetworkIdTest.java64
-rw-r--r--framework/src/onos/apps/vtn/vtnrsc/src/test/java/org/onosproject/vtnrsc/virtualport/AllowedAddressPairTest.java76
-rw-r--r--framework/src/onos/apps/vtn/vtnrsc/src/test/java/org/onosproject/vtnrsc/virtualport/DefaultVirtualPortTest.java142
-rw-r--r--framework/src/onos/apps/vtn/vtnrsc/src/test/java/org/onosproject/vtnrsc/virtualport/FixedIpTest.java72
-rw-r--r--framework/src/onos/apps/vtn/vtnrsc/src/test/java/org/onosproject/vtnrsc/virtualport/SecurityGroupTest.java66
-rw-r--r--framework/src/onos/apps/vtn/vtnrsc/src/test/java/org/onosproject/vtnrsc/virtualport/VirtualPortIdTest.java66
43 files changed, 943 insertions, 1240 deletions
diff --git a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/BindingHostId.java b/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/BindingHostId.java
index c715d08a..7dca32de 100644
--- a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/BindingHostId.java
+++ b/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/BindingHostId.java
@@ -49,7 +49,7 @@ public final class BindingHostId {
@Override
public int hashCode() {
- return Objects.hash(bindingHostId);
+ return bindingHostId.hashCode();
}
@Override
diff --git a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/DefaultFlowClassifier.java b/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/DefaultFlowClassifier.java
index 39df2cff..7915ce08 100644
--- a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/DefaultFlowClassifier.java
+++ b/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/DefaultFlowClassifier.java
@@ -43,6 +43,8 @@ public final class DefaultFlowClassifier implements FlowClassifier {
private static final int NULL_PORT = 0;
private static final String FLOW_CLASSIFIER_ID_NOT_NULL = "FlowClassifier id can not be null.";
private static final String TENANT_ID_NOT_NULL = "Tenant id can not be null.";
+ private static final String NAME_NOT_NULL = "Name can not be null.";
+ private static final String ETHER_TYPE_NOT_NULL = "Ether Type can not be null.";
/**
* Constructor to create default flow classifier.
@@ -160,11 +162,9 @@ public final class DefaultFlowClassifier implements FlowClassifier {
private FlowClassifierId flowClassifierId;
private TenantId tenantId;
private String name;
- private boolean isFlowClassifierNameSet = false;
private String description;
private boolean isFlowClassifierDescriptionSet = false;
private String etherType;
- private boolean isEtherTypeSet = false;
private String protocol;
private boolean isProtocolSet = false;
private int minSrcPortRange;
@@ -189,9 +189,9 @@ public final class DefaultFlowClassifier implements FlowClassifier {
checkNotNull(flowClassifierId, FLOW_CLASSIFIER_ID_NOT_NULL);
checkNotNull(tenantId, TENANT_ID_NOT_NULL);
- String name = null;
+ checkNotNull(name, NAME_NOT_NULL);
+ checkNotNull(etherType, ETHER_TYPE_NOT_NULL);
String description = null;
- String etherType = null;
String protocol = null;
int minSrcPortRange = NULL_PORT;
int maxSrcPortRange = NULL_PORT;
@@ -202,15 +202,9 @@ public final class DefaultFlowClassifier implements FlowClassifier {
VirtualPortId srcPort = null;
VirtualPortId dstPort = null;
- if (isFlowClassifierNameSet) {
- name = this.name;
- }
if (isFlowClassifierDescriptionSet) {
description = this.description;
}
- if (isEtherTypeSet) {
- etherType = this.etherType;
- }
if (isProtocolSet) {
protocol = this.protocol;
}
@@ -259,7 +253,6 @@ public final class DefaultFlowClassifier implements FlowClassifier {
@Override
public Builder setName(String name) {
this.name = name;
- this.isFlowClassifierNameSet = true;
return this;
}
@@ -273,7 +266,6 @@ public final class DefaultFlowClassifier implements FlowClassifier {
@Override
public Builder setEtherType(String etherType) {
this.etherType = etherType;
- this.isEtherTypeSet = true;
return this;
}
diff --git a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/FlowClassifierId.java b/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/FlowClassifierId.java
index b789abe3..df180ebe 100644
--- a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/FlowClassifierId.java
+++ b/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/FlowClassifierId.java
@@ -15,6 +15,8 @@
*/
package org.onosproject.vtnrsc;
+import static com.google.common.base.Preconditions.checkNotNull;
+
import com.google.common.base.MoreObjects;
import java.util.UUID;
@@ -33,6 +35,7 @@ public final class FlowClassifierId {
* @param flowClassifierId flow classifier id.
*/
private FlowClassifierId(final UUID flowClassifierId) {
+ checkNotNull(flowClassifierId, "Flow classifier id can not be null");
this.flowClassifierId = flowClassifierId;
}
@@ -42,7 +45,7 @@ public final class FlowClassifierId {
* @param flowClassifierId flow classifier id
* @return new flow classifier id
*/
- public static FlowClassifierId flowClassifierId(final UUID flowClassifierId) {
+ public static FlowClassifierId of(final UUID flowClassifierId) {
return new FlowClassifierId(flowClassifierId);
}
@@ -52,7 +55,7 @@ public final class FlowClassifierId {
* @param flowClassifierId flow classifier id
* @return new flow classifier id
*/
- public static FlowClassifierId flowClassifierId(final String flowClassifierId) {
+ public static FlowClassifierId of(final String flowClassifierId) {
return new FlowClassifierId(UUID.fromString(flowClassifierId));
}
diff --git a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/PhysicalNetwork.java b/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/PhysicalNetwork.java
index e96e666a..30631d28 100644
--- a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/PhysicalNetwork.java
+++ b/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/PhysicalNetwork.java
@@ -53,7 +53,7 @@ public final class PhysicalNetwork {
@Override
public int hashCode() {
- return Objects.hash(physicalNetwork);
+ return physicalNetwork.hashCode();
}
@Override
diff --git a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/PortChainId.java b/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/PortChainId.java
index 66edbdcc..a42a700f 100644
--- a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/PortChainId.java
+++ b/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/PortChainId.java
@@ -19,8 +19,7 @@ import static com.google.common.base.MoreObjects.toStringHelper;
import static com.google.common.base.Preconditions.checkNotNull;
import java.util.UUID;
-
-import com.google.common.base.Objects;
+import java.util.Objects;
/**
* Representation of a Port Chain ID.
@@ -40,22 +39,22 @@ public final class PortChainId {
}
/**
- * Constructor to create port chain id from UUID.
+ * Returns newly created port chain id object.
*
* @param id UUID of port chain
* @return object of port chain id
*/
- public static PortChainId portChainId(UUID id) {
+ public static PortChainId of(UUID id) {
return new PortChainId(id);
}
/**
- * Constructor to create port chain id from string.
+ * Returns newly created port chain id object.
*
* @param id port chain id in string
* @return object of port chain id
*/
- public static PortChainId portChainId(String id) {
+ public static PortChainId of(String id) {
return new PortChainId(UUID.fromString(id));
}
@@ -73,10 +72,9 @@ public final class PortChainId {
if (this == obj) {
return true;
}
-
- if (obj.getClass() == this.getClass()) {
- PortChainId that = (PortChainId) obj;
- return Objects.equal(this.portChainId, that.portChainId);
+ if (obj instanceof PortChainId) {
+ final PortChainId other = (PortChainId) obj;
+ return Objects.equals(this.portChainId, other.portChainId);
}
return false;
}
@@ -88,8 +86,6 @@ public final class PortChainId {
@Override
public String toString() {
- return toStringHelper(this)
- .add("portChainId", portChainId.toString())
- .toString();
+ return toStringHelper(this).add("portChainId", portChainId).toString();
}
}
diff --git a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/PortPairGroupId.java b/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/PortPairGroupId.java
index 0474901c..a52a2bb3 100644
--- a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/PortPairGroupId.java
+++ b/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/PortPairGroupId.java
@@ -19,8 +19,7 @@ import static com.google.common.base.MoreObjects.toStringHelper;
import static com.google.common.base.Preconditions.checkNotNull;
import java.util.UUID;
-
-import com.google.common.base.Objects;
+import java.util.Objects;
/**
* Representation of a Port Pair Group ID.
@@ -40,22 +39,22 @@ public final class PortPairGroupId {
}
/**
- * Constructor to create port pair group id from UUID.
+ * Returns newly created port pair group id object.
*
- * @param id UUID of port pair group id
+ * @param id port pair group id in UUID
* @return object of port pair group id
*/
- public static PortPairGroupId portPairGroupId(UUID id) {
+ public static PortPairGroupId of(UUID id) {
return new PortPairGroupId(id);
}
/**
- * Constructor to create port pair group id from string.
+ * Returns newly created port pair group id object.
*
* @param id port pair group id in string
* @return object of port pair group id
*/
- public static PortPairGroupId portPairGroupId(String id) {
+ public static PortPairGroupId of(String id) {
return new PortPairGroupId(UUID.fromString(id));
}
@@ -73,10 +72,9 @@ public final class PortPairGroupId {
if (this == obj) {
return true;
}
-
- if (obj.getClass() == this.getClass()) {
- PortPairGroupId that = (PortPairGroupId) obj;
- return Objects.equal(this.portPairGroupId, that.portPairGroupId);
+ if (obj instanceof PortPairGroupId) {
+ final PortPairGroupId other = (PortPairGroupId) obj;
+ return Objects.equals(this.portPairGroupId, other.portPairGroupId);
}
return false;
}
@@ -88,8 +86,7 @@ public final class PortPairGroupId {
@Override
public String toString() {
- return toStringHelper(this)
- .add("portPairGroupId", portPairGroupId.toString())
+ return toStringHelper(this).add("portPairGroupId", portPairGroupId)
.toString();
}
}
diff --git a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/PortPairId.java b/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/PortPairId.java
index 05c31aac..1f45e80e 100644
--- a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/PortPairId.java
+++ b/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/PortPairId.java
@@ -19,8 +19,7 @@ import static com.google.common.base.MoreObjects.toStringHelper;
import static com.google.common.base.Preconditions.checkNotNull;
import java.util.UUID;
-
-import com.google.common.base.Objects;
+import java.util.Objects;
/**
* Representation of a Port Pair ID.
@@ -40,22 +39,22 @@ public final class PortPairId {
}
/**
- * Constructor to create port pair id from UUID.
+ * Returns newly created port pair id object.
*
* @param id UUID of port pair id
* @return object of port pair id
*/
- public static PortPairId portPairId(UUID id) {
+ public static PortPairId of(UUID id) {
return new PortPairId(id);
}
/**
- * Constructor to create port pair id from string.
+ * Returns newly created port pair id object.
*
* @param id port pair id in string
* @return object of port pair id
*/
- public static PortPairId portPairId(String id) {
+ public static PortPairId of(String id) {
return new PortPairId(UUID.fromString(id));
}
@@ -73,10 +72,9 @@ public final class PortPairId {
if (this == obj) {
return true;
}
-
- if (obj.getClass() == this.getClass()) {
- PortPairId that = (PortPairId) obj;
- return Objects.equal(this.portPairId, that.portPairId);
+ if (obj instanceof PortPairId) {
+ final PortPairId other = (PortPairId) obj;
+ return Objects.equals(this.portPairId, other.portPairId);
}
return false;
}
@@ -89,7 +87,7 @@ public final class PortPairId {
@Override
public String toString() {
return toStringHelper(this)
- .add("portPairId", portPairId.toString())
+ .add("portPairId", portPairId)
.toString();
}
}
diff --git a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/Router.java b/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/Router.java
new file mode 100644
index 00000000..e853ec2f
--- /dev/null
+++ b/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/Router.java
@@ -0,0 +1,102 @@
+/*
+ * 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.List;
+
+/**
+ * Representation of a Router.
+ */
+public interface Router {
+
+ /**
+ * Coarse classification of the type of the Router.
+ */
+ public enum Status {
+ /**
+ * Signifies that a router is currently active.
+ */
+ ACTIVE,
+ /**
+ * Signifies that a router is currently inactive.
+ */
+ INACTIVE
+ }
+
+ /**
+ * Returns the router identifier.
+ *
+ * @return identifier
+ */
+ RouterId id();
+
+ /**
+ * Returns the router Name.
+ *
+ * @return routerName
+ */
+ String name();
+
+ /**
+ * Returns the router admin state.
+ *
+ * @return true or false
+ */
+ boolean adminStateUp();
+
+ /**
+ * Returns the status of router.
+ *
+ * @return RouterStatus
+ */
+ Status status();
+
+ /**
+ * Returns the distributed status of this router.
+ * If true, indicates a distributed router.
+ *
+ * @return true or false
+ */
+ boolean distributed();
+
+ /**
+ * Returns the RouterGateway of router.
+ *
+ * @return routerGateway
+ */
+ RouterGateway externalGatewayInfo();
+
+ /**
+ * Returns the gatewayPortid of router.
+ *
+ * @return virtualPortId
+ */
+ VirtualPortId gatewayPortid();
+
+ /**
+ * Returns the owner(tenant) of this router.
+ *
+ * @return tenantId
+ */
+ TenantId tenantId();
+
+ /**
+ * Returns the router list of router.
+ *
+ * @return routes
+ */
+ List<String> routes();
+}
diff --git a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/RouterGateway.java b/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/RouterGateway.java
new file mode 100644
index 00000000..9a755561
--- /dev/null
+++ b/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/RouterGateway.java
@@ -0,0 +1,108 @@
+/*
+ * 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 static com.google.common.base.MoreObjects.toStringHelper;
+import static com.google.common.base.Preconditions.checkNotNull;
+
+import java.util.Collection;
+import java.util.Objects;
+
+/**
+ * Representation of a Router gateway.
+ */
+public final class RouterGateway {
+
+ private final TenantNetworkId networkId;
+ private final boolean enableSnat;
+ private final Collection<FixedIp> externalFixedIps;
+
+ // Public construction is prohibited
+ private RouterGateway(TenantNetworkId networkId, boolean enableSnat,
+ Collection<FixedIp> externalFixedIps) {
+ this.networkId = checkNotNull(networkId, "networkId cannot be null");
+ this.enableSnat = checkNotNull(enableSnat, "enableSnat cannot be null");
+ this.externalFixedIps = checkNotNull(externalFixedIps, "externalFixedIps cannot be null");
+ }
+
+ /**
+ * Creates router gateway object.
+ *
+ * @param networkId network identifier
+ * @param enableSnat SNAT enable or not
+ * @param externalFixedIps external fixed IP
+ * @return RouterGateway
+ */
+ public static RouterGateway routerGateway(TenantNetworkId networkId, boolean enableSnat,
+ Collection<FixedIp> externalFixedIps) {
+ return new RouterGateway(networkId, enableSnat, externalFixedIps);
+ }
+
+ /**
+ * Returns network identifier.
+ *
+ * @return networkId
+ */
+ public TenantNetworkId networkId() {
+ return networkId;
+ }
+
+ /**
+ * Return SNAT enable or not.
+ *
+ * @return enableSnat
+ */
+ public boolean enableSnat() {
+ return enableSnat;
+ }
+
+ /**
+ * Return external fixed Ip.
+ *
+ * @return externalFixedIps
+ */
+ public Collection<FixedIp> externalFixedIps() {
+ return externalFixedIps;
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(networkId, enableSnat, externalFixedIps);
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (obj instanceof RouterGateway) {
+ final RouterGateway that = (RouterGateway) obj;
+ return Objects.equals(this.networkId, that.networkId)
+ && Objects.equals(this.enableSnat, that.enableSnat)
+ && Objects.equals(this.externalFixedIps, that.externalFixedIps);
+ }
+ return false;
+ }
+
+ @Override
+ public String toString() {
+ return toStringHelper(this)
+ .add("networkId", networkId)
+ .add("enableSnat", enableSnat)
+ .add("externalFixedIps", externalFixedIps)
+ .toString();
+ }
+}
diff --git a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/RouterId.java b/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/RouterId.java
new file mode 100644
index 00000000..d396c0d1
--- /dev/null
+++ b/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/RouterId.java
@@ -0,0 +1,77 @@
+/*
+ * 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 static com.google.common.base.MoreObjects.toStringHelper;
+import static com.google.common.base.Preconditions.checkNotNull;
+
+import java.util.Objects;
+
+/**
+ * Immutable representation of a router identifier.
+ */
+public final class RouterId {
+
+ private final String routerId;
+
+ // Public construction is prohibited
+ private RouterId(String routerId) {
+ checkNotNull(routerId, "routerId cannot be null");
+ this.routerId = routerId;
+ }
+
+ /**
+ * Creates a router identifier.
+ *
+ * @param routerId the router identifier
+ * @return the router identifier
+ */
+ public static RouterId valueOf(String routerId) {
+ return new RouterId(routerId);
+ }
+
+ /**
+ * Returns the router identifier.
+ *
+ * @return the router identifier
+ */
+ public String routerId() {
+ return routerId;
+ }
+
+ @Override
+ public int hashCode() {
+ return routerId.hashCode();
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (obj instanceof RouterId) {
+ final RouterId that = (RouterId) obj;
+ return Objects.equals(this.routerId, that.routerId);
+ }
+ return false;
+ }
+
+ @Override
+ public String toString() {
+ return toStringHelper(this).add("routerId", routerId).toString();
+ }
+}
+
diff --git a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/SecurityGroup.java b/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/SecurityGroup.java
index 9ec1dc63..33ddcbfe 100644
--- a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/SecurityGroup.java
+++ b/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/SecurityGroup.java
@@ -52,7 +52,7 @@ public final class SecurityGroup {
@Override
public int hashCode() {
- return Objects.hash(securityGroup);
+ return securityGroup.hashCode();
}
@Override
diff --git a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/SegmentationId.java b/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/SegmentationId.java
index a076265f..651ebd89 100644
--- a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/SegmentationId.java
+++ b/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/SegmentationId.java
@@ -53,7 +53,7 @@ public final class SegmentationId {
@Override
public int hashCode() {
- return Objects.hash(segmentationId);
+ return segmentationId.hashCode();
}
@Override
diff --git a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/SubnetId.java b/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/SubnetId.java
index 4bcc3329..eb93d153 100644
--- a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/SubnetId.java
+++ b/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/SubnetId.java
@@ -53,7 +53,7 @@ public final class SubnetId {
@Override
public int hashCode() {
- return Objects.hash(subnetId);
+ return subnetId.hashCode();
}
@Override
diff --git a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/TenantId.java b/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/TenantId.java
index c4d99e49..0e7c9417 100644
--- a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/TenantId.java
+++ b/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/TenantId.java
@@ -53,7 +53,7 @@ public final class TenantId {
@Override
public int hashCode() {
- return Objects.hash(tenantId);
+ return tenantId.hashCode();
}
@Override
diff --git a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/TenantNetworkId.java b/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/TenantNetworkId.java
index fbb9e480..8680d28f 100644
--- a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/TenantNetworkId.java
+++ b/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/TenantNetworkId.java
@@ -52,7 +52,7 @@ public final class TenantNetworkId {
@Override
public int hashCode() {
- return Objects.hash(networkId);
+ return networkId.hashCode();
}
@Override
diff --git a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/VirtualPortId.java b/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/VirtualPortId.java
index 3038bdff..a3863483 100644
--- a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/VirtualPortId.java
+++ b/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/VirtualPortId.java
@@ -46,7 +46,7 @@ public final class VirtualPortId {
@Override
public int hashCode() {
- return Objects.hash(portId);
+ return portId.hashCode();
}
@Override
diff --git a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/flowClassifier/FlowClassifierService.java b/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/flowclassifier/FlowClassifierService.java
index e379be81..c160d221 100644
--- a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/flowClassifier/FlowClassifierService.java
+++ b/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/flowclassifier/FlowClassifierService.java
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.onosproject.vtnrsc.flowClassifier;
+package org.onosproject.vtnrsc.flowclassifier;
import org.onosproject.vtnrsc.FlowClassifier;
import org.onosproject.vtnrsc.FlowClassifierId;
@@ -69,4 +69,4 @@ public interface FlowClassifierService {
* @return true if Flow Classifier removal is success otherwise return false.
*/
boolean removeFlowClassifier(FlowClassifierId id);
-} \ No newline at end of file
+}
diff --git a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/flowClassifier/impl/FlowClassifierManager.java b/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/flowclassifier/impl/FlowClassifierManager.java
index 7238558a..ee5873d6 100644
--- a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/flowClassifier/impl/FlowClassifierManager.java
+++ b/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/flowclassifier/impl/FlowClassifierManager.java
@@ -13,23 +13,28 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.onosproject.vtnrsc.flowClassifier.impl;
-
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.concurrent.ConcurrentMap;
+package org.onosproject.vtnrsc.flowclassifier.impl;
import org.apache.felix.scr.annotations.Activate;
import org.apache.felix.scr.annotations.Component;
import org.apache.felix.scr.annotations.Deactivate;
+import org.apache.felix.scr.annotations.Reference;
+import org.apache.felix.scr.annotations.ReferenceCardinality;
import org.apache.felix.scr.annotations.Service;
+import org.onlab.util.KryoNamespace;
+import org.onosproject.store.serializers.KryoNamespaces;
+import org.onosproject.store.service.EventuallyConsistentMap;
+import org.onosproject.store.service.MultiValuedTimestamp;
+import org.onosproject.store.service.StorageService;
+import org.onosproject.store.service.WallClockTimestamp;
import org.onosproject.vtnrsc.FlowClassifierId;
import org.onosproject.vtnrsc.FlowClassifier;
-import org.onosproject.vtnrsc.flowClassifier.FlowClassifierService;
-
+import org.onosproject.vtnrsc.flowclassifier.FlowClassifierService;
import org.slf4j.Logger;
-import static org.slf4j.LoggerFactory.getLogger;
+import static org.slf4j.LoggerFactory.getLogger;
import static com.google.common.base.Preconditions.checkNotNull;
+
import com.google.common.collect.ImmutableList;
/**
@@ -44,16 +49,26 @@ public class FlowClassifierManager implements FlowClassifierService {
private static final String FLOW_CLASSIFIER_NOT_NULL = "Flow Classifier cannot be null";
private static final String FLOW_CLASSIFIER_ID_NOT_NULL = "Flow Classifier Id cannot be null";
- private ConcurrentMap<FlowClassifierId, FlowClassifier> flowClassifierStore
- = new ConcurrentHashMap<FlowClassifierId, FlowClassifier>();
+ private EventuallyConsistentMap<FlowClassifierId, FlowClassifier> flowClassifierStore;
+ @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
+ protected StorageService storageService;
@Activate
private void activate() {
+ KryoNamespace.Builder serializer = KryoNamespace.newBuilder()
+ .register(KryoNamespaces.API)
+ .register(MultiValuedTimestamp.class)
+ .register(FlowClassifier.class);
+ flowClassifierStore = storageService
+ .<FlowClassifierId, FlowClassifier>eventuallyConsistentMapBuilder()
+ .withName("flowclassifierstore").withSerializer(serializer)
+ .withTimestampProvider((k, v) -> new WallClockTimestamp()).build();
log.info("Flow Classifier service activated");
}
@Deactivate
private void deactivate() {
+ flowClassifierStore.destroy();
log.info("Flow Classifier service deactivated");
}
@@ -92,7 +107,8 @@ public class FlowClassifierManager implements FlowClassifierService {
public boolean updateFlowClassifier(FlowClassifier flowClassifier) {
checkNotNull(flowClassifier, FLOW_CLASSIFIER_NOT_NULL);
FlowClassifierId id = flowClassifier.flowClassifierId();
- return flowClassifierStore.replace(id, flowClassifierStore.get(id), flowClassifier);
+ flowClassifierStore.put(id, flowClassifier);
+ return true;
}
@Override
@@ -105,4 +121,4 @@ public class FlowClassifierManager implements FlowClassifierService {
}
return true;
}
-} \ No newline at end of file
+}
diff --git a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/flowClassifier/impl/package-info.java b/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/flowclassifier/impl/package-info.java
index 4ea050b3..62b5603d 100644
--- a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/flowClassifier/impl/package-info.java
+++ b/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/flowclassifier/impl/package-info.java
@@ -17,4 +17,4 @@
/**
* Provides implementation of the flow Classifier service.
*/
-package org.onosproject.vtnrsc.flowClassifier.impl;
+package org.onosproject.vtnrsc.flowclassifier.impl;
diff --git a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/flowClassifier/package-info.java b/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/flowclassifier/package-info.java
index 07584170..c8c75bf3 100644
--- a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/flowClassifier/package-info.java
+++ b/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/flowclassifier/package-info.java
@@ -17,4 +17,4 @@
/**
* Service for interacting with flow Classifier of SFC.
*/
-package org.onosproject.vtnrsc.flowClassifier;
+package org.onosproject.vtnrsc.flowclassifier;
diff --git a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/portchain/impl/PortChainManager.java b/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/portchain/impl/PortChainManager.java
new file mode 100644
index 00000000..5201a2ca
--- /dev/null
+++ b/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/portchain/impl/PortChainManager.java
@@ -0,0 +1,146 @@
+/*
+ * 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 com.google.common.base.Preconditions.checkNotNull;
+import static org.slf4j.LoggerFactory.getLogger;
+
+import java.util.Collections;
+
+import org.apache.felix.scr.annotations.Activate;
+import org.apache.felix.scr.annotations.Component;
+import org.apache.felix.scr.annotations.Deactivate;
+import org.apache.felix.scr.annotations.Reference;
+import org.apache.felix.scr.annotations.ReferenceCardinality;
+import org.apache.felix.scr.annotations.Service;
+import org.onlab.util.KryoNamespace;
+import org.onosproject.store.serializers.KryoNamespaces;
+import org.onosproject.store.service.EventuallyConsistentMap;
+import org.onosproject.store.service.MultiValuedTimestamp;
+import org.onosproject.store.service.StorageService;
+import org.onosproject.store.service.WallClockTimestamp;
+import org.onosproject.vtnrsc.PortChain;
+import org.onosproject.vtnrsc.PortChainId;
+import org.onosproject.vtnrsc.portchain.PortChainService;
+import org.slf4j.Logger;
+
+/**
+ * Provides implementation of the portChainService.
+ */
+@Component(immediate = true)
+@Service
+public class PortChainManager implements PortChainService {
+
+ private final Logger log = getLogger(getClass());
+
+ private static final String PORT_CHAIN_ID_NULL = "PortChain ID cannot be null";
+ private static final String PORT_CHAIN_NULL = "PortChain cannot be null";
+
+ private EventuallyConsistentMap<PortChainId, PortChain> portChainStore;
+
+ @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
+ protected StorageService storageService;
+
+ @Activate
+ public void activate() {
+
+ KryoNamespace.Builder serializer = KryoNamespace.newBuilder()
+ .register(KryoNamespaces.API)
+ .register(MultiValuedTimestamp.class)
+ .register(PortChain.class);
+
+ portChainStore = storageService
+ .<PortChainId, PortChain>eventuallyConsistentMapBuilder()
+ .withName("portchainstore").withSerializer(serializer)
+ .withTimestampProvider((k, v) -> new WallClockTimestamp()).build();
+
+ log.info("Started");
+ }
+
+ @Deactivate
+ public void deactivate() {
+ portChainStore.destroy();
+ log.info("Stopped");
+ }
+
+ @Override
+ public boolean exists(PortChainId portChainId) {
+ checkNotNull(portChainId, PORT_CHAIN_ID_NULL);
+ return portChainStore.containsKey(portChainId);
+ }
+
+ @Override
+ public int getPortChainCount() {
+ return portChainStore.size();
+ }
+
+ @Override
+ public Iterable<PortChain> getPortChains() {
+ return Collections.unmodifiableCollection(portChainStore.values());
+ }
+
+ @Override
+ public PortChain getPortChain(PortChainId portChainId) {
+ checkNotNull(portChainId, PORT_CHAIN_ID_NULL);
+ return portChainStore.get(portChainId);
+ }
+
+ @Override
+ public boolean createPortChain(PortChain portChain) {
+ checkNotNull(portChain, PORT_CHAIN_NULL);
+
+ portChainStore.put(portChain.portChainId(), portChain);
+ if (!portChainStore.containsKey(portChain.portChainId())) {
+ log.debug("The portChain is created failed which identifier was {}", portChain.portChainId()
+ .toString());
+ return false;
+ }
+ return true;
+ }
+
+ @Override
+ public boolean updatePortChain(PortChain portChain) {
+ checkNotNull(portChain, PORT_CHAIN_NULL);
+
+ if (!portChainStore.containsKey(portChain.portChainId())) {
+ log.debug("The portChain is not exist whose identifier was {} ",
+ portChain.portChainId().toString());
+ return false;
+ }
+
+ portChainStore.put(portChain.portChainId(), portChain);
+
+ if (!portChain.equals(portChainStore.get(portChain.portChainId()))) {
+ log.debug("The portChain is updated failed whose identifier was {} ",
+ portChain.portChainId().toString());
+ return false;
+ }
+ return true;
+ }
+
+ @Override
+ public boolean removePortChain(PortChainId portChainId) {
+ checkNotNull(portChainId, PORT_CHAIN_NULL);
+
+ portChainStore.remove(portChainId);
+ if (portChainStore.containsKey(portChainId)) {
+ log.debug("The portChain is removed failed whose identifier was {}",
+ portChainId.toString());
+ return false;
+ }
+ return true;
+ }
+}
diff --git a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/portchain/impl/package-info.java b/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/portchain/impl/package-info.java
new file mode 100644
index 00000000..424d54ab
--- /dev/null
+++ b/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/portchain/impl/package-info.java
@@ -0,0 +1,20 @@
+/*
+ * 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.
+ */
+
+/**
+ * Implementation of service for interacting with the inventory of port chains.
+ */
+package org.onosproject.vtnrsc.portchain.impl;
diff --git a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/portpair/PortPairService.java b/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/portpair/PortPairService.java
new file mode 100644
index 00000000..f99cc2cf
--- /dev/null
+++ b/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/portpair/PortPairService.java
@@ -0,0 +1,80 @@
+/*
+ * 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;
+
+import org.onosproject.vtnrsc.PortPair;
+import org.onosproject.vtnrsc.PortPairId;
+
+/**
+ * Service for interacting with the inventory of port pairs.
+ */
+public interface PortPairService {
+
+ /**
+ * Returns if the port pair is existed.
+ *
+ * @param portPairId port pair identifier
+ * @return true or false if one with the given identifier exists.
+ */
+ boolean exists(PortPairId portPairId);
+
+ /**
+ * Returns the number of port pairs known to the system.
+ *
+ * @return number of port pairs.
+ */
+ int getPortPairCount();
+
+ /**
+ * Returns an iterable collection of the currently known port pairs.
+ *
+ * @return collection of port pairs.
+ */
+ Iterable<PortPair> getPortPairs();
+
+ /**
+ * Returns the portPair with the given identifier.
+ *
+ * @param portPairId port pair identifier
+ * @return PortPair or null if port pair with the given identifier is not
+ * known.
+ */
+ PortPair getPortPair(PortPairId portPairId);
+
+ /**
+ * Creates a PortPair in the store.
+ *
+ * @param portPair the port pair to create
+ * @return true if given port pair is created successfully.
+ */
+ boolean createPortPair(PortPair portPair);
+
+ /**
+ * Updates the portPair in the store.
+ *
+ * @param portPair the port pair to update
+ * @return true if given port pair is updated successfully.
+ */
+ boolean updatePortPair(PortPair portPair);
+
+ /**
+ * Deletes portPair by given portPairId.
+ *
+ * @param portPairId id of port pair to remove
+ * @return true if the give port pair is deleted successfully.
+ */
+ boolean removePortPair(PortPairId portPairId);
+}
diff --git a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/portpair/impl/PortPairManager.java b/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/portpair/impl/PortPairManager.java
new file mode 100644
index 00000000..93c8782a
--- /dev/null
+++ b/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/portpair/impl/PortPairManager.java
@@ -0,0 +1,146 @@
+/*
+ * 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 com.google.common.base.Preconditions.checkNotNull;
+import static org.slf4j.LoggerFactory.getLogger;
+
+import java.util.Collections;
+
+import org.apache.felix.scr.annotations.Activate;
+import org.apache.felix.scr.annotations.Component;
+import org.apache.felix.scr.annotations.Deactivate;
+import org.apache.felix.scr.annotations.Reference;
+import org.apache.felix.scr.annotations.ReferenceCardinality;
+import org.apache.felix.scr.annotations.Service;
+import org.onlab.util.KryoNamespace;
+import org.onosproject.store.serializers.KryoNamespaces;
+import org.onosproject.store.service.EventuallyConsistentMap;
+import org.onosproject.store.service.MultiValuedTimestamp;
+import org.onosproject.store.service.StorageService;
+import org.onosproject.store.service.WallClockTimestamp;
+import org.onosproject.vtnrsc.PortPair;
+import org.onosproject.vtnrsc.PortPairId;
+import org.onosproject.vtnrsc.portpair.PortPairService;
+import org.slf4j.Logger;
+
+/**
+ * Provides implementation of the portPairService.
+ */
+@Component(immediate = true)
+@Service
+public class PortPairManager implements PortPairService {
+
+ private final Logger log = getLogger(getClass());
+
+ private static final String PORT_PAIR_ID_NULL = "PortPair ID cannot be null";
+ private static final String PORT_PAIR_NULL = "PortPair cannot be null";
+
+ private EventuallyConsistentMap<PortPairId, PortPair> portPairStore;
+
+ @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
+ protected StorageService storageService;
+
+ @Activate
+ public void activate() {
+
+ KryoNamespace.Builder serializer = KryoNamespace.newBuilder()
+ .register(KryoNamespaces.API)
+ .register(MultiValuedTimestamp.class)
+ .register(PortPair.class);
+
+ portPairStore = storageService
+ .<PortPairId, PortPair>eventuallyConsistentMapBuilder()
+ .withName("portpairstore").withSerializer(serializer)
+ .withTimestampProvider((k, v) -> new WallClockTimestamp()).build();
+
+ log.info("Started");
+ }
+
+ @Deactivate
+ public void deactivate() {
+ portPairStore.destroy();
+ log.info("Stopped");
+ }
+
+ @Override
+ public boolean exists(PortPairId portPairId) {
+ checkNotNull(portPairId, PORT_PAIR_ID_NULL);
+ return portPairStore.containsKey(portPairId);
+ }
+
+ @Override
+ public int getPortPairCount() {
+ return portPairStore.size();
+ }
+
+ @Override
+ public Iterable<PortPair> getPortPairs() {
+ return Collections.unmodifiableCollection(portPairStore.values());
+ }
+
+ @Override
+ public PortPair getPortPair(PortPairId portPairId) {
+ checkNotNull(portPairId, PORT_PAIR_ID_NULL);
+ return portPairStore.get(portPairId);
+ }
+
+ @Override
+ public boolean createPortPair(PortPair portPair) {
+ checkNotNull(portPair, PORT_PAIR_NULL);
+
+ portPairStore.put(portPair.portPairId(), portPair);
+ if (!portPairStore.containsKey(portPair.portPairId())) {
+ log.debug("The portPair is created failed which identifier was {}", portPair.portPairId()
+ .toString());
+ return false;
+ }
+ return true;
+ }
+
+ @Override
+ public boolean updatePortPair(PortPair portPair) {
+ checkNotNull(portPair, PORT_PAIR_NULL);
+
+ if (!portPairStore.containsKey(portPair.portPairId())) {
+ log.debug("The portPair is not exist whose identifier was {} ",
+ portPair.portPairId().toString());
+ return false;
+ }
+
+ portPairStore.put(portPair.portPairId(), portPair);
+
+ if (!portPair.equals(portPairStore.get(portPair.portPairId()))) {
+ log.debug("The portPair is updated failed whose identifier was {} ",
+ portPair.portPairId().toString());
+ return false;
+ }
+ return true;
+ }
+
+ @Override
+ public boolean removePortPair(PortPairId portPairId) {
+ checkNotNull(portPairId, PORT_PAIR_NULL);
+
+ portPairStore.remove(portPairId);
+ if (portPairStore.containsKey(portPairId)) {
+ log.debug("The portPair is removed failed whose identifier was {}",
+ portPairId.toString());
+ return false;
+ }
+ return true;
+ }
+}
diff --git a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/portpair/impl/package-info.java b/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/portpair/impl/package-info.java
new file mode 100644
index 00000000..625fbdd4
--- /dev/null
+++ b/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/portpair/impl/package-info.java
@@ -0,0 +1,20 @@
+/*
+ * 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.
+ */
+
+/**
+ * Implementation of service for interacting with the inventory of port pairs.
+ */
+package org.onosproject.vtnrsc.portpair.impl;
diff --git a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/web/package-info.java b/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/portpair/package-info.java
index 34636a9f..e2c61531 100644
--- a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/web/package-info.java
+++ b/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/portpair/package-info.java
@@ -15,6 +15,6 @@
*/
/**
- * Codecs for virtual tenant objects.
+ * Service for interacting with the inventory of port pairs.
*/
-package org.onosproject.vtnrsc.web;
+package org.onosproject.vtnrsc.portpair;
diff --git a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/portpairgroup/impl/PortPairGroupManager.java b/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/portpairgroup/impl/PortPairGroupManager.java
new file mode 100644
index 00000000..55fb4e43
--- /dev/null
+++ b/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/portpairgroup/impl/PortPairGroupManager.java
@@ -0,0 +1,146 @@
+/*
+ * 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 com.google.common.base.Preconditions.checkNotNull;
+import static org.slf4j.LoggerFactory.getLogger;
+
+import java.util.Collections;
+
+import org.apache.felix.scr.annotations.Activate;
+import org.apache.felix.scr.annotations.Component;
+import org.apache.felix.scr.annotations.Deactivate;
+import org.apache.felix.scr.annotations.Reference;
+import org.apache.felix.scr.annotations.ReferenceCardinality;
+import org.apache.felix.scr.annotations.Service;
+import org.onlab.util.KryoNamespace;
+import org.onosproject.store.serializers.KryoNamespaces;
+import org.onosproject.store.service.EventuallyConsistentMap;
+import org.onosproject.store.service.MultiValuedTimestamp;
+import org.onosproject.store.service.StorageService;
+import org.onosproject.store.service.WallClockTimestamp;
+import org.onosproject.vtnrsc.PortPairGroup;
+import org.onosproject.vtnrsc.PortPairGroupId;
+import org.onosproject.vtnrsc.portpairgroup.PortPairGroupService;
+import org.slf4j.Logger;
+
+/**
+ * Provides implementation of the portPairGroupService.
+ */
+@Component(immediate = true)
+@Service
+public class PortPairGroupManager implements PortPairGroupService {
+
+ private final Logger log = getLogger(getClass());
+
+ private static final String PORT_PAIR_GROUP_ID_NULL = "PortPairGroup ID cannot be null";
+ private static final String PORT_PAIR_GROUP_NULL = "PortPairGroup cannot be null";
+
+ private EventuallyConsistentMap<PortPairGroupId, PortPairGroup> portPairGroupStore;
+
+ @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
+ protected StorageService storageService;
+
+ @Activate
+ public void activate() {
+
+ KryoNamespace.Builder serializer = KryoNamespace.newBuilder()
+ .register(KryoNamespaces.API)
+ .register(MultiValuedTimestamp.class)
+ .register(PortPairGroup.class);
+
+ portPairGroupStore = storageService
+ .<PortPairGroupId, PortPairGroup>eventuallyConsistentMapBuilder()
+ .withName("portpairgroupstore").withSerializer(serializer)
+ .withTimestampProvider((k, v) -> new WallClockTimestamp()).build();
+
+ log.info("Started");
+ }
+
+ @Deactivate
+ public void deactivate() {
+ portPairGroupStore.destroy();
+ log.info("Stopped");
+ }
+
+ @Override
+ public boolean exists(PortPairGroupId portPairGroupId) {
+ checkNotNull(portPairGroupId, PORT_PAIR_GROUP_ID_NULL);
+ return portPairGroupStore.containsKey(portPairGroupId);
+ }
+
+ @Override
+ public int getPortPairGroupCount() {
+ return portPairGroupStore.size();
+ }
+
+ @Override
+ public Iterable<PortPairGroup> getPortPairGroups() {
+ return Collections.unmodifiableCollection(portPairGroupStore.values());
+ }
+
+ @Override
+ public PortPairGroup getPortPairGroup(PortPairGroupId portPairGroupId) {
+ checkNotNull(portPairGroupId, PORT_PAIR_GROUP_ID_NULL);
+ return portPairGroupStore.get(portPairGroupId);
+ }
+
+ @Override
+ public boolean createPortPairGroup(PortPairGroup portPairGroup) {
+ checkNotNull(portPairGroup, PORT_PAIR_GROUP_NULL);
+
+ portPairGroupStore.put(portPairGroup.portPairGroupId(), portPairGroup);
+ if (!portPairGroupStore.containsKey(portPairGroup.portPairGroupId())) {
+ log.debug("The portPairGroup is created failed which identifier was {}", portPairGroup.portPairGroupId()
+ .toString());
+ return false;
+ }
+ return true;
+ }
+
+ @Override
+ public boolean updatePortPairGroup(PortPairGroup portPairGroup) {
+ checkNotNull(portPairGroup, PORT_PAIR_GROUP_NULL);
+
+ if (!portPairGroupStore.containsKey(portPairGroup.portPairGroupId())) {
+ log.debug("The portPairGroup is not exist whose identifier was {} ",
+ portPairGroup.portPairGroupId().toString());
+ return false;
+ }
+
+ portPairGroupStore.put(portPairGroup.portPairGroupId(), portPairGroup);
+
+ if (!portPairGroup.equals(portPairGroupStore.get(portPairGroup.portPairGroupId()))) {
+ log.debug("The portPairGroup is updated failed whose identifier was {} ",
+ portPairGroup.portPairGroupId().toString());
+ return false;
+ }
+ return true;
+ }
+
+ @Override
+ public boolean removePortPairGroup(PortPairGroupId portPairGroupId) {
+ checkNotNull(portPairGroupId, PORT_PAIR_GROUP_NULL);
+
+ portPairGroupStore.remove(portPairGroupId);
+ if (portPairGroupStore.containsKey(portPairGroupId)) {
+ log.debug("The portPairGroup is removed failed whose identifier was {}",
+ portPairGroupId.toString());
+ return false;
+ }
+ return true;
+ }
+}
diff --git a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/portpairgroup/impl/package-info.java b/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/portpairgroup/impl/package-info.java
new file mode 100644
index 00000000..68c186bc
--- /dev/null
+++ b/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/portpairgroup/impl/package-info.java
@@ -0,0 +1,20 @@
+/*
+ * 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.
+ */
+
+/**
+ * Implementation of service for interacting with the inventory of port pair groups.
+ */
+package org.onosproject.vtnrsc.portpairgroup.impl;
diff --git a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/web/FlowClassifierCodec.java b/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/web/FlowClassifierCodec.java
deleted file mode 100644
index fd5b1ee4..00000000
--- a/framework/src/onos/apps/vtn/vtnrsc/src/main/java/org/onosproject/vtnrsc/web/FlowClassifierCodec.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.web;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-import static org.onlab.util.Tools.nullIsIllegal;
-
-import java.util.UUID;
-
-import org.onlab.packet.IpPrefix;
-import org.onosproject.codec.CodecContext;
-import org.onosproject.codec.JsonCodec;
-import org.onosproject.vtnrsc.DefaultFlowClassifier;
-import org.onosproject.vtnrsc.FlowClassifier;
-import org.onosproject.vtnrsc.FlowClassifierId;
-import org.onosproject.vtnrsc.VirtualPortId;
-import org.onosproject.vtnrsc.TenantId;
-
-import com.fasterxml.jackson.databind.node.ObjectNode;
-
-/**
- * Flow Classifier JSON codec.
- */
-public final class FlowClassifierCodec extends JsonCodec<FlowClassifier> {
-
- private static final String FLOW_CLASSIFIER_ID = "id";
- private static final String TENANT_ID = "tenant_id";
- private static final String NAME = "name";
- private static final String DESCRIPTION = "description";
- private static final String ETHER_TYPE = "etherType";
- private static final String PROTOCOL = "protocol";
- private static final String MIN_SRC_PORT_RANGE = "source_port_range_min";
- private static final String MAX_SRC_PORT_RANGE = "source_port_range_max";
- private static final String MIN_DST_PORT_RANGE = "destination_port_range_min";
- private static final String MAX_DST_PORT_RANGE = "destination_port_range_max";
- private static final String SRC_IP_PREFIX = "source_ip_prefix";
- private static final String DST_IP_PREFIX = "destination_ip_prefix";
- private static final String SRC_PORT = "logical_source_port";
- private static final String DST_PORT = "logical_destination_port";
- private static final String MISSING_MEMBER_MESSAGE = " member is required in Flow Classifier.";
-
- @Override
- public FlowClassifier decode(ObjectNode json, CodecContext context) {
- if (json == null || !json.isObject()) {
- return null;
- }
-
- FlowClassifier.Builder resultBuilder = new DefaultFlowClassifier.Builder();
-
- String flowClassifierId = nullIsIllegal(json.get(FLOW_CLASSIFIER_ID),
- FLOW_CLASSIFIER_ID + MISSING_MEMBER_MESSAGE).asText();
- resultBuilder.setFlowClassifierId(FlowClassifierId.flowClassifierId(UUID.fromString(flowClassifierId)));
-
- String tenantId = nullIsIllegal(json.get(TENANT_ID), TENANT_ID + MISSING_MEMBER_MESSAGE).asText();
- resultBuilder.setTenantId(TenantId.tenantId(tenantId));
-
- String flowClassiferName = nullIsIllegal(json.get(NAME), NAME + MISSING_MEMBER_MESSAGE).asText();
- resultBuilder.setName(flowClassiferName);
-
- String flowClassiferDescription = nullIsIllegal(json.get(DESCRIPTION), DESCRIPTION + MISSING_MEMBER_MESSAGE)
- .asText();
- resultBuilder.setDescription(flowClassiferDescription);
-
- String etherType = nullIsIllegal(json.get(ETHER_TYPE), ETHER_TYPE + MISSING_MEMBER_MESSAGE).asText();
- resultBuilder.setEtherType(etherType);
-
- String protocol = nullIsIllegal(json.get(PROTOCOL), PROTOCOL + MISSING_MEMBER_MESSAGE).asText();
- resultBuilder.setProtocol(protocol);
-
- int minSrcPortRange = nullIsIllegal(json.get(MIN_SRC_PORT_RANGE), MIN_SRC_PORT_RANGE + MISSING_MEMBER_MESSAGE)
- .asInt();
- resultBuilder.setMinSrcPortRange(minSrcPortRange);
-
- int maxSrcPortRange = nullIsIllegal(json.get(MAX_SRC_PORT_RANGE), MAX_SRC_PORT_RANGE + MISSING_MEMBER_MESSAGE)
- .asInt();
- resultBuilder.setMaxSrcPortRange(maxSrcPortRange);
-
- int minDstPortRange = nullIsIllegal(json.get(MIN_DST_PORT_RANGE), MIN_DST_PORT_RANGE + MISSING_MEMBER_MESSAGE)
- .asInt();
- resultBuilder.setMinDstPortRange(minDstPortRange);
-
- int maxDstPortRange = nullIsIllegal(json.get(MAX_DST_PORT_RANGE), MAX_DST_PORT_RANGE + MISSING_MEMBER_MESSAGE)
- .asInt();
- resultBuilder.setMaxDstPortRange(maxDstPortRange);
-
- String srcIpPrefix = nullIsIllegal(json.get(SRC_IP_PREFIX), SRC_IP_PREFIX + MISSING_MEMBER_MESSAGE).asText();
- resultBuilder.setSrcIpPrefix(IpPrefix.valueOf(srcIpPrefix));
-
- String dstIpPrefix = nullIsIllegal(json.get(DST_IP_PREFIX), DST_IP_PREFIX + MISSING_MEMBER_MESSAGE).asText();
- resultBuilder.setDstIpPrefix(IpPrefix.valueOf(dstIpPrefix));
-
- String srcPort = nullIsIllegal(json.get(SRC_PORT), SRC_PORT + MISSING_MEMBER_MESSAGE).asText();
- resultBuilder.setSrcPort(VirtualPortId.portId(srcPort));
-
- String dstPort = nullIsIllegal(json.get(DST_PORT), DST_PORT + MISSING_MEMBER_MESSAGE).asText();
- resultBuilder.setDstPort(VirtualPortId.portId(dstPort));
-
- return resultBuilder.build();
- }
-
- @Override
- public ObjectNode encode(FlowClassifier flowClassifier, CodecContext context) {
- checkNotNull(flowClassifier, "flowClassifier cannot be null");
- ObjectNode result = context.mapper().createObjectNode()
- .put("FLOW_CLASSIFIER_ID", flowClassifier.flowClassifierId().toString())
- .put("TENANT_ID", flowClassifier.tenantId().toString())
- .put("NAME", flowClassifier.name())
- .put("DESCRIPTION", flowClassifier.description())
- .put("ETHER_TYPE", flowClassifier.etherType())
- .put("PROTOCOL", flowClassifier.protocol())
- .put("MIN_SRC_PORT_RANGE", flowClassifier.minSrcPortRange())
- .put("MAX_SRC_PORT_RANGE", flowClassifier.maxSrcPortRange())
- .put("MIN_DST_PORT_RANGE", flowClassifier.minDstPortRange())
- .put("MAX_DST_PORT_RANGE", flowClassifier.maxDstPortRange())
- .put("SRC_IP_PREFIX", flowClassifier.srcIpPrefix().toString())
- .put("DST_IP_PREFIX", flowClassifier.dstIpPrefix().toString())
- .put("SRC_PORT", flowClassifier.srcPort().toString())
- .put("DST_PORT", flowClassifier.dstPort().toString());
- return result;
- }
-} \ No newline at end of file
diff --git a/framework/src/onos/apps/vtn/vtnrsc/src/test/java/org/onosproject/vtnrsc/flowclassifier/FlowClassifierIdTest.java b/framework/src/onos/apps/vtn/vtnrsc/src/test/java/org/onosproject/vtnrsc/flowclassifier/FlowClassifierIdTest.java
deleted file mode 100644
index b2fed347..00000000
--- a/framework/src/onos/apps/vtn/vtnrsc/src/test/java/org/onosproject/vtnrsc/flowclassifier/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.flowclassifier;
-
-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.FlowClassifierId;
-
-import com.google.common.testing.EqualsTester;
-import java.util.UUID;
-
-/**
- * Unit tests for FlowClassifierId class.
- */
-public class FlowClassifierIdTest {
-
- final FlowClassifierId flowClassifierId1 = FlowClassifierId
- .flowClassifierId("78dcd363-fc23-aeb6-f44b-56dc5e2fb3ae");
- final FlowClassifierId sameAsFlowClassifierId1 = FlowClassifierId
- .flowClassifierId("78dcd363-fc23-aeb6-f44b-56dc5e2fb3ae");
- final FlowClassifierId flowClassifierId2 = FlowClassifierId
- .flowClassifierId("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.flowClassifierId(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/subnet/DefaultAllocationPoolTest.java b/framework/src/onos/apps/vtn/vtnrsc/src/test/java/org/onosproject/vtnrsc/subnet/DefaultAllocationPoolTest.java
deleted file mode 100644
index 4ce4def2..00000000
--- a/framework/src/onos/apps/vtn/vtnrsc/src/test/java/org/onosproject/vtnrsc/subnet/DefaultAllocationPoolTest.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.subnet;
-
-import static org.hamcrest.MatcherAssert.assertThat;
-import static org.hamcrest.Matchers.is;
-import static org.onlab.junit.ImmutableClassChecker.assertThatClassIsImmutable;
-
-import org.junit.Test;
-import org.onlab.packet.IpAddress;
-import org.onosproject.vtnrsc.AllocationPool;
-import org.onosproject.vtnrsc.DefaultAllocationPool;
-
-import com.google.common.testing.EqualsTester;
-
-/**
- * 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/subnet/DefaultHostRouteTest.java b/framework/src/onos/apps/vtn/vtnrsc/src/test/java/org/onosproject/vtnrsc/subnet/DefaultHostRouteTest.java
deleted file mode 100644
index 2f751742..00000000
--- a/framework/src/onos/apps/vtn/vtnrsc/src/test/java/org/onosproject/vtnrsc/subnet/DefaultHostRouteTest.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.subnet;
-
-import static org.hamcrest.MatcherAssert.assertThat;
-import static org.hamcrest.Matchers.is;
-import static org.onlab.junit.ImmutableClassChecker.assertThatClassIsImmutable;
-
-import org.junit.Test;
-import org.onlab.packet.IpAddress;
-import org.onlab.packet.IpPrefix;
-import org.onosproject.vtnrsc.DefaultHostRoute;
-import org.onosproject.vtnrsc.HostRoute;
-
-import com.google.common.testing.EqualsTester;
-
-/**
- * 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/subnet/SubnetIdTest.java b/framework/src/onos/apps/vtn/vtnrsc/src/test/java/org/onosproject/vtnrsc/subnet/SubnetIdTest.java
deleted file mode 100644
index d18dd41a..00000000
--- a/framework/src/onos/apps/vtn/vtnrsc/src/test/java/org/onosproject/vtnrsc/subnet/SubnetIdTest.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.subnet;
-
-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.SubnetId;
-
-import com.google.common.testing.EqualsTester;
-
-/**
- * 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/tenantnetwork/DefaultNeutronNetworkTest.java b/framework/src/onos/apps/vtn/vtnrsc/src/test/java/org/onosproject/vtnrsc/tenantnetwork/DefaultNeutronNetworkTest.java
deleted file mode 100644
index 742d5933..00000000
--- a/framework/src/onos/apps/vtn/vtnrsc/src/test/java/org/onosproject/vtnrsc/tenantnetwork/DefaultNeutronNetworkTest.java
+++ /dev/null
@@ -1,83 +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.tenantnetwork;
-
-import static org.onlab.junit.ImmutableClassChecker.assertThatClassIsImmutable;
-
-import org.junit.Test;
-import org.onosproject.vtnrsc.DefaultTenantNetwork;
-import org.onosproject.vtnrsc.PhysicalNetwork;
-import org.onosproject.vtnrsc.SegmentationId;
-import org.onosproject.vtnrsc.TenantId;
-import org.onosproject.vtnrsc.TenantNetwork;
-import org.onosproject.vtnrsc.TenantNetworkId;
-
-import com.google.common.testing.EqualsTester;
-
-/**
- * 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/tenantnetwork/PhysicalNetworkTest.java b/framework/src/onos/apps/vtn/vtnrsc/src/test/java/org/onosproject/vtnrsc/tenantnetwork/PhysicalNetworkTest.java
deleted file mode 100644
index e101795e..00000000
--- a/framework/src/onos/apps/vtn/vtnrsc/src/test/java/org/onosproject/vtnrsc/tenantnetwork/PhysicalNetworkTest.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.tenantnetwork;
-
-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.PhysicalNetwork;
-
-import com.google.common.testing.EqualsTester;
-
-/**
- * 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/tenantnetwork/SegmentationIdTest.java b/framework/src/onos/apps/vtn/vtnrsc/src/test/java/org/onosproject/vtnrsc/tenantnetwork/SegmentationIdTest.java
deleted file mode 100644
index dea7baf6..00000000
--- a/framework/src/onos/apps/vtn/vtnrsc/src/test/java/org/onosproject/vtnrsc/tenantnetwork/SegmentationIdTest.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.tenantnetwork;
-
-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.SegmentationId;
-
-import com.google.common.testing.EqualsTester;
-
-/**
- * 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/tenantnetwork/TenantIdTest.java b/framework/src/onos/apps/vtn/vtnrsc/src/test/java/org/onosproject/vtnrsc/tenantnetwork/TenantIdTest.java
deleted file mode 100644
index e9216383..00000000
--- a/framework/src/onos/apps/vtn/vtnrsc/src/test/java/org/onosproject/vtnrsc/tenantnetwork/TenantIdTest.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.tenantnetwork;
-
-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.TenantId;
-
-import com.google.common.testing.EqualsTester;
-
-/**
- * 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/tenantnetwork/TenantNetworkIdTest.java b/framework/src/onos/apps/vtn/vtnrsc/src/test/java/org/onosproject/vtnrsc/tenantnetwork/TenantNetworkIdTest.java
deleted file mode 100644
index 8271b51c..00000000
--- a/framework/src/onos/apps/vtn/vtnrsc/src/test/java/org/onosproject/vtnrsc/tenantnetwork/TenantNetworkIdTest.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.tenantnetwork;
-
-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.TenantNetworkId;
-
-import com.google.common.testing.EqualsTester;
-
-/**
- * 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/virtualport/AllowedAddressPairTest.java b/framework/src/onos/apps/vtn/vtnrsc/src/test/java/org/onosproject/vtnrsc/virtualport/AllowedAddressPairTest.java
deleted file mode 100644
index dabe5896..00000000
--- a/framework/src/onos/apps/vtn/vtnrsc/src/test/java/org/onosproject/vtnrsc/virtualport/AllowedAddressPairTest.java
+++ /dev/null
@@ -1,76 +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.virtualport;
-
-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.onlab.packet.MacAddress;
-import org.onosproject.vtnrsc.AllowedAddressPair;
-
-import com.google.common.testing.EqualsTester;
-
-/**
- * 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/virtualport/DefaultVirtualPortTest.java b/framework/src/onos/apps/vtn/vtnrsc/src/test/java/org/onosproject/vtnrsc/virtualport/DefaultVirtualPortTest.java
deleted file mode 100644
index 8a0c8004..00000000
--- a/framework/src/onos/apps/vtn/vtnrsc/src/test/java/org/onosproject/vtnrsc/virtualport/DefaultVirtualPortTest.java
+++ /dev/null
@@ -1,142 +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.virtualport;
-
-import static org.onlab.junit.ImmutableClassChecker.assertThatClassIsImmutable;
-
-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 org.onosproject.vtnrsc.AllowedAddressPair;
-import org.onosproject.vtnrsc.BindingHostId;
-import org.onosproject.vtnrsc.DefaultVirtualPort;
-import org.onosproject.vtnrsc.FixedIp;
-import org.onosproject.vtnrsc.SecurityGroup;
-import org.onosproject.vtnrsc.SubnetId;
-import org.onosproject.vtnrsc.TenantId;
-import org.onosproject.vtnrsc.TenantNetworkId;
-import org.onosproject.vtnrsc.VirtualPort;
-import org.onosproject.vtnrsc.VirtualPortId;
-
-import com.google.common.collect.Maps;
-import com.google.common.collect.Sets;
-import com.google.common.testing.EqualsTester;
-
-/**
- * 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/virtualport/FixedIpTest.java b/framework/src/onos/apps/vtn/vtnrsc/src/test/java/org/onosproject/vtnrsc/virtualport/FixedIpTest.java
deleted file mode 100644
index 1e33da09..00000000
--- a/framework/src/onos/apps/vtn/vtnrsc/src/test/java/org/onosproject/vtnrsc/virtualport/FixedIpTest.java
+++ /dev/null
@@ -1,72 +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.virtualport;
-
-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.FixedIp;
-import org.onosproject.vtnrsc.SubnetId;
-
-import com.google.common.testing.EqualsTester;
-
-/**
- * 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/virtualport/SecurityGroupTest.java b/framework/src/onos/apps/vtn/vtnrsc/src/test/java/org/onosproject/vtnrsc/virtualport/SecurityGroupTest.java
deleted file mode 100644
index 8c04e499..00000000
--- a/framework/src/onos/apps/vtn/vtnrsc/src/test/java/org/onosproject/vtnrsc/virtualport/SecurityGroupTest.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.virtualport;
-
-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.SecurityGroup;
-
-import com.google.common.testing.EqualsTester;
-
-/**
- * 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/virtualport/VirtualPortIdTest.java b/framework/src/onos/apps/vtn/vtnrsc/src/test/java/org/onosproject/vtnrsc/virtualport/VirtualPortIdTest.java
deleted file mode 100644
index 2d63e91c..00000000
--- a/framework/src/onos/apps/vtn/vtnrsc/src/test/java/org/onosproject/vtnrsc/virtualport/VirtualPortIdTest.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.virtualport;
-
-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.VirtualPortId;
-
-import com.google.common.testing.EqualsTester;
-
-/**
- * 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));
-
- }
-}