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
Showing
4 changed files
with
22 additions
and
22 deletions
... | @@ -16,7 +16,6 @@ | ... | @@ -16,7 +16,6 @@ |
16 | package org.onosproject.vpls; | 16 | package org.onosproject.vpls; |
17 | 17 | ||
18 | import com.google.common.collect.SetMultimap; | 18 | import com.google.common.collect.SetMultimap; |
19 | - | ||
20 | import org.apache.commons.lang3.tuple.Pair; | 19 | import org.apache.commons.lang3.tuple.Pair; |
21 | import org.onlab.packet.MacAddress; | 20 | import org.onlab.packet.MacAddress; |
22 | import org.onlab.packet.VlanId; | 21 | import org.onlab.packet.VlanId; |
... | @@ -101,22 +100,21 @@ public class IntentInstaller { | ... | @@ -101,22 +100,21 @@ public class IntentInstaller { |
101 | .collect(Collectors.toSet()); | 100 | .collect(Collectors.toSet()); |
102 | Key brcKey = buildKey(PREFIX_BROADCAST, src, vlanId); | 101 | Key brcKey = buildKey(PREFIX_BROADCAST, src, vlanId); |
103 | 102 | ||
104 | - if (intentService.getIntent(brcKey) == null && dsts.size() > 0) { | 103 | + if (dsts.isEmpty()) { |
105 | - intents.add(buildBrcIntent(brcKey, src, dsts, vlanId)); | 104 | + return; |
106 | } | 105 | } |
107 | 106 | ||
108 | - if (mac != null && countMacInCPoints(cPoints) > 1 && | 107 | + intents.add(buildBrcIntent(brcKey, src, dsts, vlanId)); |
109 | - dsts.size() > 0) { | 108 | + |
109 | + if (mac != null && countMacInCPoints(cPoints) > 1) { | ||
110 | Key uniKey = buildKey(PREFIX_UNICAST, src, vlanId); | 110 | Key uniKey = buildKey(PREFIX_UNICAST, src, vlanId); |
111 | - if (intentService.getIntent(uniKey) == null) { | 111 | + MultiPointToSinglePointIntent uniIntent = |
112 | - MultiPointToSinglePointIntent uniIntent = | 112 | + buildUniIntent(uniKey, |
113 | - buildUniIntent(uniKey, | 113 | + dsts, |
114 | - dsts, | 114 | + src, |
115 | - src, | 115 | + vlanId, |
116 | - vlanId, | 116 | + mac); |
117 | - mac); | 117 | + intents.add(uniIntent); |
118 | - intents.add(uniIntent); | ||
119 | - } | ||
120 | } | 118 | } |
121 | }); | 119 | }); |
122 | }); | 120 | }); | ... | ... |
... | @@ -100,13 +100,13 @@ public class Vpls { | ... | @@ -100,13 +100,13 @@ public class Vpls { |
100 | 100 | ||
101 | setupConnectivity(); | 101 | setupConnectivity(); |
102 | 102 | ||
103 | - log.debug("Activated"); | 103 | + log.info("Activated"); |
104 | } | 104 | } |
105 | 105 | ||
106 | @Deactivate | 106 | @Deactivate |
107 | public void deactivate() { | 107 | public void deactivate() { |
108 | intentSynchronizer.removeIntentsByAppId(appId); | 108 | intentSynchronizer.removeIntentsByAppId(appId); |
109 | - log.debug("Deactivated"); | 109 | + log.info("Deactivated"); |
110 | } | 110 | } |
111 | 111 | ||
112 | protected void setupConnectivity() { | 112 | protected void setupConnectivity() { | ... | ... |
... | @@ -126,7 +126,7 @@ public class VplsNeighbourHandler { | ... | @@ -126,7 +126,7 @@ public class VplsNeighbourHandler { |
126 | case REQUEST: | 126 | case REQUEST: |
127 | interfaceService.getInterfacesByVlan(context.vlan()) | 127 | interfaceService.getInterfacesByVlan(context.vlan()) |
128 | .stream() | 128 | .stream() |
129 | - .map(Interface::connectPoint) | 129 | + .filter(intf -> !context.inPort().equals(intf.connectPoint())) |
130 | .forEach(context::forward); | 130 | .forEach(context::forward); |
131 | break; | 131 | break; |
132 | case REPLY: | 132 | case REPLY: | ... | ... |
... | @@ -17,11 +17,13 @@ package org.onosproject.vpls; | ... | @@ -17,11 +17,13 @@ package org.onosproject.vpls; |
17 | 17 | ||
18 | import java.util.Collections; | 18 | import java.util.Collections; |
19 | import java.util.List; | 19 | import java.util.List; |
20 | +import java.util.Map; | ||
20 | import java.util.Set; | 21 | import java.util.Set; |
21 | import java.util.concurrent.atomic.AtomicLong; | 22 | import java.util.concurrent.atomic.AtomicLong; |
22 | import java.util.stream.Collectors; | 23 | import java.util.stream.Collectors; |
23 | 24 | ||
24 | import com.google.common.collect.Lists; | 25 | import com.google.common.collect.Lists; |
26 | +import com.google.common.collect.Maps; | ||
25 | import org.junit.After; | 27 | import org.junit.After; |
26 | import org.junit.Before; | 28 | import org.junit.Before; |
27 | import org.junit.Test; | 29 | import org.junit.Test; |
... | @@ -574,15 +576,15 @@ public class VplsTest { | ... | @@ -574,15 +576,15 @@ public class VplsTest { |
574 | */ | 576 | */ |
575 | private class TestIntentService extends IntentServiceAdapter { | 577 | private class TestIntentService extends IntentServiceAdapter { |
576 | 578 | ||
577 | - private Set<Intent> intents; | 579 | + private Map<Key, Intent> intents; |
578 | 580 | ||
579 | public TestIntentService() { | 581 | public TestIntentService() { |
580 | - intents = Sets.newHashSet(); | 582 | + intents = Maps.newHashMap(); |
581 | } | 583 | } |
582 | 584 | ||
583 | @Override | 585 | @Override |
584 | public void submit(Intent intent) { | 586 | public void submit(Intent intent) { |
585 | - intents.add(intent); | 587 | + intents.put(intent.key(), intent); |
586 | } | 588 | } |
587 | 589 | ||
588 | @Override | 590 | @Override |
... | @@ -592,12 +594,12 @@ public class VplsTest { | ... | @@ -592,12 +594,12 @@ public class VplsTest { |
592 | 594 | ||
593 | @Override | 595 | @Override |
594 | public Iterable<Intent> getIntents() { | 596 | public Iterable<Intent> getIntents() { |
595 | - return intents; | 597 | + return intents.values(); |
596 | } | 598 | } |
597 | 599 | ||
598 | @Override | 600 | @Override |
599 | public Intent getIntent(Key intentKey) { | 601 | public Intent getIntent(Key intentKey) { |
600 | - for (Intent intent : intents) { | 602 | + for (Intent intent : intents.values()) { |
601 | if (intent.key().equals(intentKey)) { | 603 | if (intent.key().equals(intentKey)) { |
602 | return intent; | 604 | return intent; |
603 | } | 605 | } | ... | ... |
-
Please register or login to post a comment