aboutsummaryrefslogtreecommitdiffstats
path: root/framework/src/onos/apps/sdnip/src/main/java/org/onosproject/sdnip/IntentUtils.java
diff options
context:
space:
mode:
authorAshlee Young <ashlee@wildernessvoice.com>2015-11-22 10:02:05 -0800
committerAshlee Young <ashlee@wildernessvoice.com>2015-11-22 10:02:05 -0800
commit77ce3be7567bd01c66d8ee88a93b485666723501 (patch)
tree283e7f39a501750bbd705fbb91645b20198900f1 /framework/src/onos/apps/sdnip/src/main/java/org/onosproject/sdnip/IntentUtils.java
parent00e6500d0813dcbccaaa741ef38cc1eae6d11e07 (diff)
Removed patch path since changes have been merged upstream to a different path. Updated README with directions.
Change-Id: Ie419abd2d3d3ef7315de9f607dcd757a78190995 Signed-off-by: Ashlee Young <ashlee@wildernessvoice.com>
Diffstat (limited to 'framework/src/onos/apps/sdnip/src/main/java/org/onosproject/sdnip/IntentUtils.java')
-rw-r--r--framework/src/onos/apps/sdnip/src/main/java/org/onosproject/sdnip/IntentUtils.java18
1 files changed, 13 insertions, 5 deletions
diff --git a/framework/src/onos/apps/sdnip/src/main/java/org/onosproject/sdnip/IntentUtils.java b/framework/src/onos/apps/sdnip/src/main/java/org/onosproject/sdnip/IntentUtils.java
index 8e2a3df3..863de12a 100644
--- a/framework/src/onos/apps/sdnip/src/main/java/org/onosproject/sdnip/IntentUtils.java
+++ b/framework/src/onos/apps/sdnip/src/main/java/org/onosproject/sdnip/IntentUtils.java
@@ -19,13 +19,12 @@ package org.onosproject.sdnip;
import org.onosproject.net.intent.Intent;
import org.onosproject.net.intent.MultiPointToSinglePointIntent;
import org.onosproject.net.intent.PointToPointIntent;
+import org.onosproject.net.intent.SinglePointToMultiPointIntent;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.Objects;
-import static com.google.common.base.Preconditions.checkArgument;
-
/**
* Utilities for dealing with intents.
*/
@@ -49,15 +48,24 @@ public final class IntentUtils {
* @return true if the two intents represent the same value, otherwise false
*/
public static boolean equals(Intent one, Intent two) {
- checkArgument(one.getClass() == two.getClass(),
- "Intents are not the same type");
+ if (one.getClass() != two.getClass()) {
+ return false;
+ }
if (!(Objects.equals(one.appId(), two.appId()) &&
Objects.equals(one.key(), two.key()))) {
return false;
}
- if (one instanceof MultiPointToSinglePointIntent) {
+ if (one instanceof SinglePointToMultiPointIntent) {
+ SinglePointToMultiPointIntent intent1 = (SinglePointToMultiPointIntent) one;
+ SinglePointToMultiPointIntent intent2 = (SinglePointToMultiPointIntent) two;
+
+ return Objects.equals(intent1.selector(), intent2.selector()) &&
+ Objects.equals(intent1.treatment(), intent2.treatment()) &&
+ Objects.equals(intent1.ingressPoint(), intent2.ingressPoint()) &&
+ Objects.equals(intent1.egressPoints(), intent2.egressPoints());
+ } else if (one instanceof MultiPointToSinglePointIntent) {
MultiPointToSinglePointIntent intent1 = (MultiPointToSinglePointIntent) one;
MultiPointToSinglePointIntent intent2 = (MultiPointToSinglePointIntent) two;