Committed by
Gerrit Code Review
support addition and removal of mcast sinks
vlan mcast rules are now optional Change-Id: Icb7022089a6e139970040d8cdea97df0cdc8dc7c
Showing
6 changed files
with
49 additions
and
33 deletions
This diff is collapsed. Click to expand it.
... | @@ -246,7 +246,7 @@ public class IgmpSnoop { | ... | @@ -246,7 +246,7 @@ public class IgmpSnoop { |
246 | .withMeta(DefaultTrafficTreatment.builder() | 246 | .withMeta(DefaultTrafficTreatment.builder() |
247 | .setOutput(PortNumber.CONTROLLER).build()) | 247 | .setOutput(PortNumber.CONTROLLER).build()) |
248 | .fromApp(appId) | 248 | .fromApp(appId) |
249 | - .withPriority(1000) | 249 | + .withPriority(10000) |
250 | .add(new ObjectiveContext() { | 250 | .add(new ObjectiveContext() { |
251 | @Override | 251 | @Override |
252 | public void onSuccess(Objective objective) { | 252 | public void onSuccess(Objective objective) { |
... | @@ -417,6 +417,7 @@ public class IgmpSnoop { | ... | @@ -417,6 +417,7 @@ public class IgmpSnoop { |
417 | private class InternalDeviceListener implements DeviceListener { | 417 | private class InternalDeviceListener implements DeviceListener { |
418 | @Override | 418 | @Override |
419 | public void event(DeviceEvent event) { | 419 | public void event(DeviceEvent event) { |
420 | + DeviceId devId = event.subject().id(); | ||
420 | switch (event.type()) { | 421 | switch (event.type()) { |
421 | 422 | ||
422 | case DEVICE_ADDED: | 423 | case DEVICE_ADDED: |
... | @@ -427,11 +428,15 @@ public class IgmpSnoop { | ... | @@ -427,11 +428,15 @@ public class IgmpSnoop { |
427 | case PORT_STATS_UPDATED: | 428 | case PORT_STATS_UPDATED: |
428 | break; | 429 | break; |
429 | case PORT_ADDED: | 430 | case PORT_ADDED: |
430 | - if (event.port().isEnabled()) { | 431 | + if (!oltData.get(devId).uplink().equals(event.port().number()) && |
432 | + event.port().isEnabled()) { | ||
431 | processFilterObjective(event.subject().id(), event.port(), false); | 433 | processFilterObjective(event.subject().id(), event.port(), false); |
432 | } | 434 | } |
433 | break; | 435 | break; |
434 | case PORT_UPDATED: | 436 | case PORT_UPDATED: |
437 | + if (oltData.get(devId).uplink().equals(event.port().number())) { | ||
438 | + break; | ||
439 | + } | ||
435 | if (event.port().isEnabled()) { | 440 | if (event.port().isEnabled()) { |
436 | processFilterObjective(event.subject().id(), event.port(), false); | 441 | processFilterObjective(event.subject().id(), event.port(), false); |
437 | } else { | 442 | } else { | ... | ... |
... | @@ -15,13 +15,10 @@ | ... | @@ -15,13 +15,10 @@ |
15 | */ | 15 | */ |
16 | package org.onosproject.store.serializers; | 16 | package org.onosproject.store.serializers; |
17 | 17 | ||
18 | -import com.esotericsoftware.kryo.serializers.JavaSerializer; | ||
19 | import com.google.common.collect.ImmutableList; | 18 | import com.google.common.collect.ImmutableList; |
20 | import com.google.common.collect.ImmutableMap; | 19 | import com.google.common.collect.ImmutableMap; |
21 | import com.google.common.collect.ImmutableSet; | 20 | import com.google.common.collect.ImmutableSet; |
22 | import com.google.common.collect.Maps; | 21 | import com.google.common.collect.Maps; |
23 | -import com.google.common.collect.Sets; | ||
24 | - | ||
25 | import org.onlab.packet.ChassisId; | 22 | import org.onlab.packet.ChassisId; |
26 | import org.onlab.packet.EthType; | 23 | import org.onlab.packet.EthType; |
27 | import org.onlab.packet.Ip4Address; | 24 | import org.onlab.packet.Ip4Address; |
... | @@ -90,8 +87,8 @@ import org.onosproject.net.device.DefaultPortDescription; | ... | @@ -90,8 +87,8 @@ import org.onosproject.net.device.DefaultPortDescription; |
90 | import org.onosproject.net.device.DefaultPortStatistics; | 87 | import org.onosproject.net.device.DefaultPortStatistics; |
91 | import org.onosproject.net.device.OchPortDescription; | 88 | import org.onosproject.net.device.OchPortDescription; |
92 | import org.onosproject.net.device.OduCltPortDescription; | 89 | import org.onosproject.net.device.OduCltPortDescription; |
93 | -import org.onosproject.net.device.OtuPortDescription; | ||
94 | import org.onosproject.net.device.OmsPortDescription; | 90 | import org.onosproject.net.device.OmsPortDescription; |
91 | +import org.onosproject.net.device.OtuPortDescription; | ||
95 | import org.onosproject.net.device.PortStatistics; | 92 | import org.onosproject.net.device.PortStatistics; |
96 | import org.onosproject.net.flow.CompletedBatchOperation; | 93 | import org.onosproject.net.flow.CompletedBatchOperation; |
97 | import org.onosproject.net.flow.DefaultFlowEntry; | 94 | import org.onosproject.net.flow.DefaultFlowEntry; |
... | @@ -257,12 +254,11 @@ public final class KryoNamespaces { | ... | @@ -257,12 +254,11 @@ public final class KryoNamespaces { |
257 | .register(HashMap.class) | 254 | .register(HashMap.class) |
258 | .register(ConcurrentHashMap.class) | 255 | .register(ConcurrentHashMap.class) |
259 | .register(CopyOnWriteArraySet.class) | 256 | .register(CopyOnWriteArraySet.class) |
260 | - .register(new JavaSerializer(), Sets.newConcurrentHashSet().getClass()) | ||
261 | .register(ArrayList.class, | 257 | .register(ArrayList.class, |
262 | LinkedList.class, | 258 | LinkedList.class, |
263 | HashSet.class, | 259 | HashSet.class, |
264 | LinkedHashSet.class | 260 | LinkedHashSet.class |
265 | - ) | 261 | + ) |
266 | .register(Maps.immutableEntry("a", "b").getClass()) | 262 | .register(Maps.immutableEntry("a", "b").getClass()) |
267 | .register(new ArraysAsListSerializer(), Arrays.asList().getClass()) | 263 | .register(new ArraysAsListSerializer(), Arrays.asList().getClass()) |
268 | .register(Collections.singletonList(1).getClass()) | 264 | .register(Collections.singletonList(1).getClass()) |
... | @@ -541,5 +537,6 @@ public final class KryoNamespaces { | ... | @@ -541,5 +537,6 @@ public final class KryoNamespaces { |
541 | 537 | ||
542 | 538 | ||
543 | // not to be instantiated | 539 | // not to be instantiated |
544 | - private KryoNamespaces() {} | 540 | + private KryoNamespaces() { |
541 | + } | ||
545 | } | 542 | } | ... | ... |
... | @@ -25,6 +25,7 @@ import org.apache.commons.lang3.tuple.Pair; | ... | @@ -25,6 +25,7 @@ import org.apache.commons.lang3.tuple.Pair; |
25 | import org.onlab.osgi.ServiceDirectory; | 25 | import org.onlab.osgi.ServiceDirectory; |
26 | import org.onlab.packet.EthType; | 26 | import org.onlab.packet.EthType; |
27 | import org.onlab.packet.IPv4; | 27 | import org.onlab.packet.IPv4; |
28 | +import org.onlab.packet.IpPrefix; | ||
28 | import org.onlab.packet.VlanId; | 29 | import org.onlab.packet.VlanId; |
29 | import org.onlab.util.KryoNamespace; | 30 | import org.onlab.util.KryoNamespace; |
30 | import org.onosproject.core.ApplicationId; | 31 | import org.onosproject.core.ApplicationId; |
... | @@ -47,6 +48,7 @@ import org.onosproject.net.flow.TrafficTreatment; | ... | @@ -47,6 +48,7 @@ import org.onosproject.net.flow.TrafficTreatment; |
47 | import org.onosproject.net.flow.criteria.Criteria; | 48 | import org.onosproject.net.flow.criteria.Criteria; |
48 | import org.onosproject.net.flow.criteria.Criterion; | 49 | import org.onosproject.net.flow.criteria.Criterion; |
49 | import org.onosproject.net.flow.criteria.EthTypeCriterion; | 50 | import org.onosproject.net.flow.criteria.EthTypeCriterion; |
51 | +import org.onosproject.net.flow.criteria.IPCriterion; | ||
50 | import org.onosproject.net.flow.criteria.IPProtocolCriterion; | 52 | import org.onosproject.net.flow.criteria.IPProtocolCriterion; |
51 | import org.onosproject.net.flow.criteria.PortCriterion; | 53 | import org.onosproject.net.flow.criteria.PortCriterion; |
52 | import org.onosproject.net.flow.criteria.VlanIdCriterion; | 54 | import org.onosproject.net.flow.criteria.VlanIdCriterion; |
... | @@ -99,6 +101,7 @@ public class OltPipeline extends AbstractHandlerBehaviour implements Pipeliner { | ... | @@ -99,6 +101,7 @@ public class OltPipeline extends AbstractHandlerBehaviour implements Pipeliner { |
99 | 101 | ||
100 | private DeviceId deviceId; | 102 | private DeviceId deviceId; |
101 | private ApplicationId appId; | 103 | private ApplicationId appId; |
104 | + private IpPrefix mcastPrefix = IpPrefix.valueOf("224.0.0.0/4"); | ||
102 | 105 | ||
103 | protected FlowObjectiveStore flowObjectiveStore; | 106 | protected FlowObjectiveStore flowObjectiveStore; |
104 | 107 | ||
... | @@ -253,26 +256,33 @@ public class OltPipeline extends AbstractHandlerBehaviour implements Pipeliner { | ... | @@ -253,26 +256,33 @@ public class OltPipeline extends AbstractHandlerBehaviour implements Pipeliner { |
253 | GroupBucket bucket = DefaultGroupBucket.createAllGroupBucket(treatment); | 256 | GroupBucket bucket = DefaultGroupBucket.createAllGroupBucket(treatment); |
254 | GroupKey key = new DefaultGroupKey(appKryo.serialize(nextObjective.id())); | 257 | GroupKey key = new DefaultGroupKey(appKryo.serialize(nextObjective.id())); |
255 | 258 | ||
256 | - GroupDescription groupDesc = | 259 | + |
257 | - new DefaultGroupDescription(deviceId, | ||
258 | - GroupDescription.Type.ALL, | ||
259 | - new GroupBuckets(Collections.singletonList(bucket)), | ||
260 | - key, | ||
261 | - null, | ||
262 | - nextObjective.appId()); | ||
263 | 260 | ||
264 | pendingGroups.put(key, nextObjective); | 261 | pendingGroups.put(key, nextObjective); |
265 | 262 | ||
266 | switch (nextObjective.op()) { | 263 | switch (nextObjective.op()) { |
267 | case ADD: | 264 | case ADD: |
265 | + GroupDescription groupDesc = | ||
266 | + new DefaultGroupDescription(deviceId, | ||
267 | + GroupDescription.Type.ALL, | ||
268 | + new GroupBuckets(Collections.singletonList(bucket)), | ||
269 | + key, | ||
270 | + null, | ||
271 | + nextObjective.appId()); | ||
268 | groupService.addGroup(groupDesc); | 272 | groupService.addGroup(groupDesc); |
269 | break; | 273 | break; |
270 | case REMOVE: | 274 | case REMOVE: |
271 | groupService.removeGroup(deviceId, key, nextObjective.appId()); | 275 | groupService.removeGroup(deviceId, key, nextObjective.appId()); |
272 | break; | 276 | break; |
273 | case ADD_TO_EXISTING: | 277 | case ADD_TO_EXISTING: |
278 | + groupService.addBucketsToGroup(deviceId, key, | ||
279 | + new GroupBuckets(Collections.singletonList(bucket)), | ||
280 | + key, nextObjective.appId()); | ||
281 | + break; | ||
274 | case REMOVE_FROM_EXISTING: | 282 | case REMOVE_FROM_EXISTING: |
275 | - //TODO: handle addition to group when caller signals it. | 283 | + groupService.removeBucketsFromGroup(deviceId, key, |
284 | + new GroupBuckets(Collections.singletonList(bucket)), | ||
285 | + key, nextObjective.appId()); | ||
276 | break; | 286 | break; |
277 | default: | 287 | default: |
278 | log.warn("Unknown next objective operation: {}", nextObjective.op()); | 288 | log.warn("Unknown next objective operation: {}", nextObjective.op()); |
... | @@ -287,14 +297,14 @@ public class OltPipeline extends AbstractHandlerBehaviour implements Pipeliner { | ... | @@ -287,14 +297,14 @@ public class OltPipeline extends AbstractHandlerBehaviour implements Pipeliner { |
287 | fail(fwd, ObjectiveError.BADPARAMS); | 297 | fail(fwd, ObjectiveError.BADPARAMS); |
288 | } | 298 | } |
289 | 299 | ||
290 | - OLTPipelineGroup next = getGroupForNextObjective(fwd.nextId()); | 300 | + GroupKey key = getGroupForNextObjective(fwd.nextId()); |
291 | 301 | ||
292 | - if (next == null) { | 302 | + if (key == null) { |
293 | log.error("Group for forwarding objective missing: {}", fwd); | 303 | log.error("Group for forwarding objective missing: {}", fwd); |
294 | fail(fwd, ObjectiveError.GROUPMISSING); | 304 | fail(fwd, ObjectiveError.GROUPMISSING); |
295 | } | 305 | } |
296 | 306 | ||
297 | - Group group = groupService.getGroup(deviceId, next.key()); | 307 | + Group group = groupService.getGroup(deviceId, key); |
298 | TrafficTreatment treatment = | 308 | TrafficTreatment treatment = |
299 | buildTreatment(Instructions.createGroup(group.id())); | 309 | buildTreatment(Instructions.createGroup(group.id())); |
300 | 310 | ||
... | @@ -330,16 +340,20 @@ public class OltPipeline extends AbstractHandlerBehaviour implements Pipeliner { | ... | @@ -330,16 +340,20 @@ public class OltPipeline extends AbstractHandlerBehaviour implements Pipeliner { |
330 | 340 | ||
331 | private boolean checkForMulticast(ForwardingObjective fwd) { | 341 | private boolean checkForMulticast(ForwardingObjective fwd) { |
332 | 342 | ||
333 | - VlanIdCriterion vlan = (VlanIdCriterion) filterForCriterion(fwd.selector().criteria(), | 343 | + IPCriterion ip = (IPCriterion) filterForCriterion(fwd.selector().criteria(), |
334 | - Criterion.Type.VLAN_VID); | 344 | + Criterion.Type.IPV4_DST); |
345 | + | ||
346 | + if (ip == null) { | ||
347 | + return false; | ||
348 | + } | ||
335 | 349 | ||
336 | - return (vlan != null && vlan.vlanId().equals(VlanId.vlanId(MCAST_VLAN))); | 350 | + return mcastPrefix.contains(ip.ip()); |
337 | 351 | ||
338 | } | 352 | } |
339 | 353 | ||
340 | - private OLTPipelineGroup getGroupForNextObjective(Integer nextId) { | 354 | + private GroupKey getGroupForNextObjective(Integer nextId) { |
341 | NextGroup next = flowObjectiveStore.getNextGroup(nextId); | 355 | NextGroup next = flowObjectiveStore.getNextGroup(nextId); |
342 | - return (OLTPipelineGroup) appKryo.deserialize(next.data()); | 356 | + return appKryo.deserialize(next.data()); |
343 | 357 | ||
344 | } | 358 | } |
345 | 359 | ... | ... |
... | @@ -54,12 +54,12 @@ public class DistributedMcastStore extends AbstractStore<McastEvent, McastStoreD | ... | @@ -54,12 +54,12 @@ public class DistributedMcastStore extends AbstractStore<McastEvent, McastStoreD |
54 | mcastRib = storageService.<McastRoute, MulticastData>consistentMapBuilder() | 54 | mcastRib = storageService.<McastRoute, MulticastData>consistentMapBuilder() |
55 | .withName(MCASTRIB) | 55 | .withName(MCASTRIB) |
56 | .withSerializer(Serializer.using(KryoNamespace.newBuilder() | 56 | .withSerializer(Serializer.using(KryoNamespace.newBuilder() |
57 | - .register(KryoNamespaces.API) | 57 | + .register(KryoNamespaces.API) |
58 | - .register( | 58 | + .register( |
59 | - MulticastData.class, | 59 | + MulticastData.class, |
60 | - McastRoute.class, | 60 | + McastRoute.class, |
61 | - McastRoute.Type.class | 61 | + McastRoute.Type.class |
62 | - ).build())) | 62 | + ).build())) |
63 | //.withRelaxedReadConsistency() | 63 | //.withRelaxedReadConsistency() |
64 | .build(); | 64 | .build(); |
65 | 65 | ... | ... |
... | @@ -66,9 +66,9 @@ public final class MulticastData { | ... | @@ -66,9 +66,9 @@ public final class MulticastData { |
66 | sinks.put(sink, true); | 66 | sinks.put(sink, true); |
67 | } | 67 | } |
68 | 68 | ||
69 | - public boolean removeSink(ConnectPoint sink) { | 69 | + public void removeSink(ConnectPoint sink) { |
70 | checkNotNull(sink); | 70 | checkNotNull(sink); |
71 | - return sinks.remove(sink); | 71 | + sinks.remove(sink); |
72 | } | 72 | } |
73 | 73 | ||
74 | public boolean isEmpty() { | 74 | public boolean isEmpty() { | ... | ... |
-
Please register or login to post a comment