Charles Chan
Committed by Yuta HIGUCHI

CORD-135 Support Multicast Source on a Configured Port

Change-Id: I71965dbb649a798cd1991bcb4d921919a30420d5
...@@ -20,6 +20,7 @@ import com.google.common.collect.ImmutableSet; ...@@ -20,6 +20,7 @@ import com.google.common.collect.ImmutableSet;
20 import com.google.common.collect.Lists; 20 import com.google.common.collect.Lists;
21 import com.google.common.collect.Sets; 21 import com.google.common.collect.Sets;
22 import org.onlab.packet.Ethernet; 22 import org.onlab.packet.Ethernet;
23 +import org.onlab.packet.Ip4Prefix;
23 import org.onlab.packet.IpAddress; 24 import org.onlab.packet.IpAddress;
24 import org.onlab.packet.IpPrefix; 25 import org.onlab.packet.IpPrefix;
25 import org.onlab.packet.MacAddress; 26 import org.onlab.packet.MacAddress;
...@@ -352,14 +353,19 @@ public class McastHandler { ...@@ -352,14 +353,19 @@ public class McastHandler {
352 return; 353 return;
353 } 354 }
354 355
356 + // Reuse unicast VLAN if the port has subnet configured
357 + Ip4Prefix portSubnet = srManager.deviceConfiguration.getPortSubnet(deviceId, port);
358 + VlanId unicastVlan = srManager.getSubnetAssignedVlanId(deviceId, portSubnet);
359 + final VlanId finalVlanId = (unicastVlan != null) ? unicastVlan : assignedVlan;
360 +
355 FilteringObjective.Builder filtObjBuilder = 361 FilteringObjective.Builder filtObjBuilder =
356 - filterObjBuilder(deviceId, port, assignedVlan); 362 + filterObjBuilder(deviceId, port, finalVlanId);
357 ObjectiveContext context = new DefaultObjectiveContext( 363 ObjectiveContext context = new DefaultObjectiveContext(
358 (objective) -> log.debug("Successfully add filter on {}/{}, vlan {}", 364 (objective) -> log.debug("Successfully add filter on {}/{}, vlan {}",
359 - deviceId, port.toLong(), assignedVlan), 365 + deviceId, port.toLong(), finalVlanId),
360 (objective, error) -> 366 (objective, error) ->
361 log.warn("Failed to add filter on {}/{}, vlan {}: {}", 367 log.warn("Failed to add filter on {}/{}, vlan {}: {}",
362 - deviceId, port.toLong(), assignedVlan, error)); 368 + deviceId, port.toLong(), finalVlanId, error));
363 srManager.flowObjectiveService.filter(deviceId, filtObjBuilder.add(context)); 369 srManager.flowObjectiveService.filter(deviceId, filtObjBuilder.add(context));
364 } 370 }
365 371
......