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
This commit is contained in:
Luca Prete 2016-09-22 14:52:21 -07:00 committed by Gerrit Code Review
parent 28e1b3e092
commit c21c6e63a1
4 changed files with 22 additions and 22 deletions

View File

@ -16,7 +16,6 @@
package org.onosproject.vpls; package org.onosproject.vpls;
import com.google.common.collect.SetMultimap; import com.google.common.collect.SetMultimap;
import org.apache.commons.lang3.tuple.Pair; import org.apache.commons.lang3.tuple.Pair;
import org.onlab.packet.MacAddress; import org.onlab.packet.MacAddress;
import org.onlab.packet.VlanId; import org.onlab.packet.VlanId;
@ -101,14 +100,14 @@ public class IntentInstaller {
.collect(Collectors.toSet()); .collect(Collectors.toSet());
Key brcKey = buildKey(PREFIX_BROADCAST, src, vlanId); Key brcKey = buildKey(PREFIX_BROADCAST, src, vlanId);
if (intentService.getIntent(brcKey) == null && dsts.size() > 0) { if (dsts.isEmpty()) {
intents.add(buildBrcIntent(brcKey, src, dsts, vlanId)); return;
} }
if (mac != null && countMacInCPoints(cPoints) > 1 && intents.add(buildBrcIntent(brcKey, src, dsts, vlanId));
dsts.size() > 0) {
if (mac != null && countMacInCPoints(cPoints) > 1) {
Key uniKey = buildKey(PREFIX_UNICAST, src, vlanId); Key uniKey = buildKey(PREFIX_UNICAST, src, vlanId);
if (intentService.getIntent(uniKey) == null) {
MultiPointToSinglePointIntent uniIntent = MultiPointToSinglePointIntent uniIntent =
buildUniIntent(uniKey, buildUniIntent(uniKey,
dsts, dsts,
@ -117,7 +116,6 @@ public class IntentInstaller {
mac); mac);
intents.add(uniIntent); intents.add(uniIntent);
} }
}
}); });
}); });
submitIntents(intents); submitIntents(intents);

View File

@ -100,13 +100,13 @@ public class Vpls {
setupConnectivity(); setupConnectivity();
log.debug("Activated"); log.info("Activated");
} }
@Deactivate @Deactivate
public void deactivate() { public void deactivate() {
intentSynchronizer.removeIntentsByAppId(appId); intentSynchronizer.removeIntentsByAppId(appId);
log.debug("Deactivated"); log.info("Deactivated");
} }
protected void setupConnectivity() { protected void setupConnectivity() {

View File

@ -126,7 +126,7 @@ public class VplsNeighbourHandler {
case REQUEST: case REQUEST:
interfaceService.getInterfacesByVlan(context.vlan()) interfaceService.getInterfacesByVlan(context.vlan())
.stream() .stream()
.map(Interface::connectPoint) .filter(intf -> !context.inPort().equals(intf.connectPoint()))
.forEach(context::forward); .forEach(context::forward);
break; break;
case REPLY: case REPLY:

View File

@ -17,11 +17,13 @@ package org.onosproject.vpls;
import java.util.Collections; import java.util.Collections;
import java.util.List; import java.util.List;
import java.util.Map;
import java.util.Set; import java.util.Set;
import java.util.concurrent.atomic.AtomicLong; import java.util.concurrent.atomic.AtomicLong;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import org.junit.After; import org.junit.After;
import org.junit.Before; import org.junit.Before;
import org.junit.Test; import org.junit.Test;
@ -574,15 +576,15 @@ public class VplsTest {
*/ */
private class TestIntentService extends IntentServiceAdapter { private class TestIntentService extends IntentServiceAdapter {
private Set<Intent> intents; private Map<Key, Intent> intents;
public TestIntentService() { public TestIntentService() {
intents = Sets.newHashSet(); intents = Maps.newHashMap();
} }
@Override @Override
public void submit(Intent intent) { public void submit(Intent intent) {
intents.add(intent); intents.put(intent.key(), intent);
} }
@Override @Override
@ -592,12 +594,12 @@ public class VplsTest {
@Override @Override
public Iterable<Intent> getIntents() { public Iterable<Intent> getIntents() {
return intents; return intents.values();
} }
@Override @Override
public Intent getIntent(Key intentKey) { public Intent getIntent(Key intentKey) {
for (Intent intent : intents) { for (Intent intent : intents.values()) {
if (intent.key().equals(intentKey)) { if (intent.key().equals(intentKey)) {
return intent; return intent;
} }