Luca Prete
Committed by Gerrit Code Review

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
......@@ -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 @@ public class IntentInstaller {
.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);
}
});
});
......
......@@ -100,13 +100,13 @@ public class Vpls {
setupConnectivity();
log.debug("Activated");
log.info("Activated");
}
@Deactivate
public void deactivate() {
intentSynchronizer.removeIntentsByAppId(appId);
log.debug("Deactivated");
log.info("Deactivated");
}
protected void setupConnectivity() {
......
......@@ -126,7 +126,7 @@ public class VplsNeighbourHandler {
case REQUEST:
interfaceService.getInterfacesByVlan(context.vlan())
.stream()
.map(Interface::connectPoint)
.filter(intf -> !context.inPort().equals(intf.connectPoint()))
.forEach(context::forward);
break;
case REPLY:
......
......@@ -17,11 +17,13 @@ package org.onosproject.vpls;
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 @@ public class VplsTest {
*/
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 @@ public class VplsTest {
@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;
}
......