diff --git a/apps/segmentrouting/src/main/java/org/onosproject/segmentrouting/McastHandler.java b/apps/segmentrouting/src/main/java/org/onosproject/segmentrouting/McastHandler.java index bbbbc3cb2d..a51d2f4e0c 100644 --- a/apps/segmentrouting/src/main/java/org/onosproject/segmentrouting/McastHandler.java +++ b/apps/segmentrouting/src/main/java/org/onosproject/segmentrouting/McastHandler.java @@ -774,7 +774,7 @@ public class McastHandler { } // Reuse unicast VLAN if the port has subnet configured if (cp != null) { - VlanId untaggedVlan = srManager.getUntaggedVlanId(cp); + VlanId untaggedVlan = srManager.getInternalVlanId(cp); return (untaggedVlan != null) ? untaggedVlan : INTERNAL_VLAN; } // Use DEFAULT_VLAN if none of the above matches diff --git a/drivers/default/src/main/java/org/onosproject/driver/pipeline/ofdpa/CpqdOfdpa2Pipeline.java b/drivers/default/src/main/java/org/onosproject/driver/pipeline/ofdpa/CpqdOfdpa2Pipeline.java index 9f2e84ca76..c5698a473d 100644 --- a/drivers/default/src/main/java/org/onosproject/driver/pipeline/ofdpa/CpqdOfdpa2Pipeline.java +++ b/drivers/default/src/main/java/org/onosproject/driver/pipeline/ofdpa/CpqdOfdpa2Pipeline.java @@ -326,7 +326,7 @@ public class CpqdOfdpa2Pipeline extends Ofdpa2Pipeline { // Multicast MAC if (ethCriterion.mask() != null) { - return processMcastEthDstFilter(ethCriterion, applicationId); + return processMcastEthDstFilter(ethCriterion, assignedVlan, applicationId); } //handling untagged packets via assigned VLAN diff --git a/drivers/default/src/main/java/org/onosproject/driver/pipeline/ofdpa/CpqdOfdpa2VlanPipeline.java b/drivers/default/src/main/java/org/onosproject/driver/pipeline/ofdpa/CpqdOfdpa2VlanPipeline.java index 8a4101509b..701b76e83e 100644 --- a/drivers/default/src/main/java/org/onosproject/driver/pipeline/ofdpa/CpqdOfdpa2VlanPipeline.java +++ b/drivers/default/src/main/java/org/onosproject/driver/pipeline/ofdpa/CpqdOfdpa2VlanPipeline.java @@ -98,7 +98,7 @@ public class CpqdOfdpa2VlanPipeline extends CpqdOfdpa2Pipeline { // Multicast MAC if (ethCriterion.mask() != null) { - return processMcastEthDstFilter(ethCriterion, applicationId); + return processMcastEthDstFilter(ethCriterion, assignedVlan, applicationId); } //handling untagged packets via assigned VLAN diff --git a/drivers/default/src/main/java/org/onosproject/driver/pipeline/ofdpa/Ofdpa2Pipeline.java b/drivers/default/src/main/java/org/onosproject/driver/pipeline/ofdpa/Ofdpa2Pipeline.java index b123accd67..e00d5fc4fe 100644 --- a/drivers/default/src/main/java/org/onosproject/driver/pipeline/ofdpa/Ofdpa2Pipeline.java +++ b/drivers/default/src/main/java/org/onosproject/driver/pipeline/ofdpa/Ofdpa2Pipeline.java @@ -93,6 +93,8 @@ import java.util.concurrent.TimeUnit; import static java.util.concurrent.Executors.newScheduledThreadPool; import static org.onlab.packet.MacAddress.BROADCAST; +import static org.onlab.packet.MacAddress.IPV4_MULTICAST; +import static org.onlab.packet.MacAddress.IPV6_MULTICAST; import static org.onlab.packet.MacAddress.NONE; import static org.onlab.util.Tools.groupedThreads; import static org.onosproject.driver.pipeline.ofdpa.OfdpaGroupHandlerUtility.*; @@ -637,7 +639,7 @@ public class Ofdpa2Pipeline extends AbstractHandlerBehaviour implements Pipeline // Multicast MAC if (ethCriterion.mask() != null) { - return processMcastEthDstFilter(ethCriterion, applicationId); + return processMcastEthDstFilter(ethCriterion, assignedVlan, applicationId); } //handling untagged packets via assigned VLAN @@ -870,37 +872,47 @@ public class Ofdpa2Pipeline extends AbstractHandlerBehaviour implements Pipeline } protected List processMcastEthDstFilter(EthCriterion ethCriterion, + VlanId assignedVlan, ApplicationId applicationId) { ImmutableList.Builder builder = ImmutableList.builder(); TrafficSelector.Builder selector = DefaultTrafficSelector.builder(); TrafficTreatment.Builder treatment = DefaultTrafficTreatment.builder(); - selector.matchEthType(Ethernet.TYPE_IPV4); - selector.matchEthDstMasked(ethCriterion.mac(), ethCriterion.mask()); - treatment.transition(MULTICAST_ROUTING_TABLE); - FlowRule rule = DefaultFlowRule.builder() - .forDevice(deviceId) - .withSelector(selector.build()) - .withTreatment(treatment.build()) - .withPriority(DEFAULT_PRIORITY) - .fromApp(applicationId) - .makePermanent() - .forTable(TMAC_TABLE).build(); - builder.add(rule); + FlowRule rule; - selector = DefaultTrafficSelector.builder(); - treatment = DefaultTrafficTreatment.builder(); - selector.matchEthType(Ethernet.TYPE_IPV6); - selector.matchEthDstMasked(ethCriterion.mac(), ethCriterion.mask()); - treatment.transition(MULTICAST_ROUTING_TABLE); - rule = DefaultFlowRule.builder() - .forDevice(deviceId) - .withSelector(selector.build()) - .withTreatment(treatment.build()) - .withPriority(DEFAULT_PRIORITY) - .fromApp(applicationId) - .makePermanent() - .forTable(TMAC_TABLE).build(); - return builder.add(rule).build(); + if (IPV4_MULTICAST.equals(ethCriterion.mac())) { + selector.matchEthType(Ethernet.TYPE_IPV4); + selector.matchEthDstMasked(ethCriterion.mac(), ethCriterion.mask()); + selector.matchVlanId(assignedVlan); + treatment.transition(MULTICAST_ROUTING_TABLE); + rule = DefaultFlowRule.builder() + .forDevice(deviceId) + .withSelector(selector.build()) + .withTreatment(treatment.build()) + .withPriority(DEFAULT_PRIORITY) + .fromApp(applicationId) + .makePermanent() + .forTable(TMAC_TABLE).build(); + builder.add(rule); + } + + if (IPV6_MULTICAST.equals(ethCriterion.mac())) { + selector = DefaultTrafficSelector.builder(); + treatment = DefaultTrafficTreatment.builder(); + selector.matchEthType(Ethernet.TYPE_IPV6); + selector.matchEthDstMasked(ethCriterion.mac(), ethCriterion.mask()); + selector.matchVlanId(assignedVlan); + treatment.transition(MULTICAST_ROUTING_TABLE); + rule = DefaultFlowRule.builder() + .forDevice(deviceId) + .withSelector(selector.build()) + .withTreatment(treatment.build()) + .withPriority(DEFAULT_PRIORITY) + .fromApp(applicationId) + .makePermanent() + .forTable(TMAC_TABLE).build(); + builder.add(rule); + } + return builder.build(); } private Collection processForward(ForwardingObjective fwd) {