Fixes for VPLS app
- fix intent installion on re-activation
- don't send ARP requests to inport
- send ARP requests to interfaces instead of connect point
Change-Id: I8f9185d174160adb605b8b44e7d7ebddb49bd027
diff --git a/apps/vpls/src/main/java/org/onosproject/vpls/IntentInstaller.java b/apps/vpls/src/main/java/org/onosproject/vpls/IntentInstaller.java
index d1d1d1a..79ed713 100644
--- a/apps/vpls/src/main/java/org/onosproject/vpls/IntentInstaller.java
+++ b/apps/vpls/src/main/java/org/onosproject/vpls/IntentInstaller.java
@@ -16,7 +16,6 @@
package org.onosproject.vpls;
import com.google.common.collect.SetMultimap;
-
import org.apache.commons.lang3.tuple.Pair;
import org.onlab.packet.MacAddress;
import org.onlab.packet.VlanId;
@@ -101,22 +100,21 @@
.collect(Collectors.toSet());
Key brcKey = buildKey(PREFIX_BROADCAST, src, vlanId);
- if (intentService.getIntent(brcKey) == null && dsts.size() > 0) {
- intents.add(buildBrcIntent(brcKey, src, dsts, vlanId));
+ if (dsts.isEmpty()) {
+ return;
}
- if (mac != null && countMacInCPoints(cPoints) > 1 &&
- dsts.size() > 0) {
+ intents.add(buildBrcIntent(brcKey, src, dsts, vlanId));
+
+ if (mac != null && countMacInCPoints(cPoints) > 1) {
Key uniKey = buildKey(PREFIX_UNICAST, src, vlanId);
- if (intentService.getIntent(uniKey) == null) {
- MultiPointToSinglePointIntent uniIntent =
- buildUniIntent(uniKey,
- dsts,
- src,
- vlanId,
- mac);
- intents.add(uniIntent);
- }
+ MultiPointToSinglePointIntent uniIntent =
+ buildUniIntent(uniKey,
+ dsts,
+ src,
+ vlanId,
+ mac);
+ intents.add(uniIntent);
}
});
});
diff --git a/apps/vpls/src/main/java/org/onosproject/vpls/Vpls.java b/apps/vpls/src/main/java/org/onosproject/vpls/Vpls.java
index 298615b..2951d13 100644
--- a/apps/vpls/src/main/java/org/onosproject/vpls/Vpls.java
+++ b/apps/vpls/src/main/java/org/onosproject/vpls/Vpls.java
@@ -100,13 +100,13 @@
setupConnectivity();
- log.debug("Activated");
+ log.info("Activated");
}
@Deactivate
public void deactivate() {
intentSynchronizer.removeIntentsByAppId(appId);
- log.debug("Deactivated");
+ log.info("Deactivated");
}
protected void setupConnectivity() {
diff --git a/apps/vpls/src/main/java/org/onosproject/vpls/VplsNeighbourHandler.java b/apps/vpls/src/main/java/org/onosproject/vpls/VplsNeighbourHandler.java
index dad993b..69b8e34 100644
--- a/apps/vpls/src/main/java/org/onosproject/vpls/VplsNeighbourHandler.java
+++ b/apps/vpls/src/main/java/org/onosproject/vpls/VplsNeighbourHandler.java
@@ -126,7 +126,7 @@
case REQUEST:
interfaceService.getInterfacesByVlan(context.vlan())
.stream()
- .map(Interface::connectPoint)
+ .filter(intf -> !context.inPort().equals(intf.connectPoint()))
.forEach(context::forward);
break;
case REPLY:
diff --git a/apps/vpls/src/test/java/org/onosproject/vpls/VplsTest.java b/apps/vpls/src/test/java/org/onosproject/vpls/VplsTest.java
index ffc9c09..8f0556c 100644
--- a/apps/vpls/src/test/java/org/onosproject/vpls/VplsTest.java
+++ b/apps/vpls/src/test/java/org/onosproject/vpls/VplsTest.java
@@ -17,11 +17,13 @@
import java.util.Collections;
import java.util.List;
+import java.util.Map;
import java.util.Set;
import java.util.concurrent.atomic.AtomicLong;
import java.util.stream.Collectors;
import com.google.common.collect.Lists;
+import com.google.common.collect.Maps;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
@@ -574,15 +576,15 @@
*/
private class TestIntentService extends IntentServiceAdapter {
- private Set<Intent> intents;
+ private Map<Key, Intent> intents;
public TestIntentService() {
- intents = Sets.newHashSet();
+ intents = Maps.newHashMap();
}
@Override
public void submit(Intent intent) {
- intents.add(intent);
+ intents.put(intent.key(), intent);
}
@Override
@@ -592,12 +594,12 @@
@Override
public Iterable<Intent> getIntents() {
- return intents;
+ return intents.values();
}
@Override
public Intent getIntent(Key intentKey) {
- for (Intent intent : intents) {
+ for (Intent intent : intents.values()) {
if (intent.key().equals(intentKey)) {
return intent;
}