ConsistentLinkResourceStore to replace HazelcastLinkResourceStore. Also
includes:
- typo fix (intendId -> intentId)
- refactored ResourceAllocations command so it doesn't use error handling as
part of control flow
- add ability to compare LinkResourceAllocations
Reference: ONOS-1076
Conflicts:
cli/src/main/java/org/onosproject/cli/net/ResourceAllocationsCommand.java
Change-Id: I6a68012d8d7d359ce7c5dcd31e80a3b9f63d5670
diff --git a/core/api/src/main/java/org/onosproject/net/resource/BandwidthResourceRequest.java b/core/api/src/main/java/org/onosproject/net/resource/BandwidthResourceRequest.java
index 6c7d249..4e012fc 100644
--- a/core/api/src/main/java/org/onosproject/net/resource/BandwidthResourceRequest.java
+++ b/core/api/src/main/java/org/onosproject/net/resource/BandwidthResourceRequest.java
@@ -15,6 +15,8 @@
*/
package org.onosproject.net.resource;
+import java.util.Objects;
+
import com.google.common.base.MoreObjects;
/**
@@ -48,6 +50,23 @@
}
@Override
+ public int hashCode() {
+ return Objects.hash(bandwidth);
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (obj == null || getClass() != obj.getClass()) {
+ return false;
+ }
+ final BandwidthResourceAllocation other = (BandwidthResourceAllocation) obj;
+ return Objects.equals(this.bandwidth, other.bandwidth());
+ }
+
+ @Override
public String toString() {
return MoreObjects.toStringHelper(this)
.add("bandwidth", bandwidth)
diff --git a/core/api/src/main/java/org/onosproject/net/resource/DefaultLinkResourceAllocations.java b/core/api/src/main/java/org/onosproject/net/resource/DefaultLinkResourceAllocations.java
index b2c8fa1..3a2f66d 100644
--- a/core/api/src/main/java/org/onosproject/net/resource/DefaultLinkResourceAllocations.java
+++ b/core/api/src/main/java/org/onosproject/net/resource/DefaultLinkResourceAllocations.java
@@ -27,6 +27,7 @@
import java.util.Collection;
import java.util.Collections;
import java.util.Map;
+import java.util.Objects;
import java.util.Map.Entry;
import java.util.Set;
@@ -56,8 +57,8 @@
}
@Override
- public IntentId intendId() {
- return request.intendId();
+ public IntentId intentId() {
+ return request.intentId();
}
@Override
@@ -85,6 +86,24 @@
}
@Override
+ public int hashCode() {
+ return Objects.hash(request, allocations);
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (obj == null || getClass() != obj.getClass()) {
+ return false;
+ }
+ final DefaultLinkResourceAllocations other = (DefaultLinkResourceAllocations) obj;
+ return Objects.equals(this.request, other.request)
+ && Objects.equals(this.allocations, other.allocations);
+ }
+
+ @Override
public String toString() {
return MoreObjects.toStringHelper(this)
.add("allocations", allocations)
diff --git a/core/api/src/main/java/org/onosproject/net/resource/DefaultLinkResourceRequest.java b/core/api/src/main/java/org/onosproject/net/resource/DefaultLinkResourceRequest.java
index 10c991c..0c6f4bf 100644
--- a/core/api/src/main/java/org/onosproject/net/resource/DefaultLinkResourceRequest.java
+++ b/core/api/src/main/java/org/onosproject/net/resource/DefaultLinkResourceRequest.java
@@ -18,12 +18,14 @@
import java.util.Collection;
import java.util.HashSet;
import java.util.Set;
+import java.util.Objects;
import org.onosproject.net.Link;
import org.onosproject.net.intent.Constraint;
import org.onosproject.net.intent.IntentId;
import com.google.common.collect.ImmutableSet;
+
import org.onosproject.net.intent.constraint.BandwidthConstraint;
import org.onosproject.net.intent.constraint.LambdaConstraint;
@@ -59,7 +61,7 @@
}
@Override
- public IntentId intendId() {
+ public IntentId intentId() {
return intentId;
}
@@ -150,7 +152,6 @@
return this;
}
-
/**
* Returns link resource request.
*
@@ -162,4 +163,21 @@
}
}
+ @Override
+ public int hashCode() {
+ return Objects.hash(intentId, links);
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (obj == null || getClass() != obj.getClass()) {
+ return false;
+ }
+ final DefaultLinkResourceRequest other = (DefaultLinkResourceRequest) obj;
+ return Objects.equals(this.intentId, other.intentId)
+ && Objects.equals(this.links, other.links);
+ }
}
diff --git a/core/api/src/main/java/org/onosproject/net/resource/LinkResourceRequest.java b/core/api/src/main/java/org/onosproject/net/resource/LinkResourceRequest.java
index 8ac3fe1..06671eb 100644
--- a/core/api/src/main/java/org/onosproject/net/resource/LinkResourceRequest.java
+++ b/core/api/src/main/java/org/onosproject/net/resource/LinkResourceRequest.java
@@ -32,7 +32,7 @@
*
* @return the {@link IntentId} associated with the request
*/
- IntentId intendId();
+ IntentId intentId();
/**
* Returns the set of target links.
diff --git a/core/api/src/main/java/org/onosproject/store/service/TransactionalMap.java b/core/api/src/main/java/org/onosproject/store/service/TransactionalMap.java
index ebc6611..657d933 100644
--- a/core/api/src/main/java/org/onosproject/store/service/TransactionalMap.java
+++ b/core/api/src/main/java/org/onosproject/store/service/TransactionalMap.java
@@ -16,7 +16,6 @@
package org.onosproject.store.service;
-
/**
* Transactional Map data structure.
* <p>