Avoid programming TMAC entries for BSOD vlans
When an interfaces is defined with tagged VLAN(s) and no IP addresses, do not install TMAC entries for that VLAN(s).
Change-Id: I5beeb38c0b21cdd69a0da90943f768c3aeddb720
diff --git a/apps/segmentrouting/app/src/main/java/org/onosproject/segmentrouting/RoutingRulePopulator.java b/apps/segmentrouting/app/src/main/java/org/onosproject/segmentrouting/RoutingRulePopulator.java
index ccc4833..4cfdaa0 100644
--- a/apps/segmentrouting/app/src/main/java/org/onosproject/segmentrouting/RoutingRulePopulator.java
+++ b/apps/segmentrouting/app/src/main/java/org/onosproject/segmentrouting/RoutingRulePopulator.java
@@ -52,6 +52,7 @@
import org.onosproject.segmentrouting.config.DeviceConfiguration;
import org.onosproject.segmentrouting.grouphandler.DefaultGroupHandler;
import org.onosproject.segmentrouting.grouphandler.DestinationSet;
+import org.onosproject.net.intf.Interface;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -985,7 +986,23 @@
private boolean processSinglePortFiltersInternal(DeviceId deviceId, PortNumber portnum,
boolean pushVlan, VlanId vlanId, boolean install) {
- FilteringObjective.Builder fob = buildFilteringObjective(deviceId, portnum, pushVlan, vlanId);
+ boolean doTMAC = true;
+
+ if (!pushVlan) {
+ // Skip the tagged vlans belonging to an interface without an IP address
+ Set<Interface> ifaces = srManager.interfaceService
+ .getInterfacesByPort(new ConnectPoint(deviceId, portnum))
+ .stream()
+ .filter(intf -> intf.vlanTagged().contains(vlanId) && intf.ipAddressesList().isEmpty())
+ .collect(Collectors.toSet());
+ if (!ifaces.isEmpty()) {
+ log.debug("processSinglePortFiltersInternal: skipping TMAC for vlan {} at {}/{} - no IP",
+ vlanId, deviceId, portnum);
+ doTMAC = false;
+ }
+ }
+
+ FilteringObjective.Builder fob = buildFilteringObjective(deviceId, portnum, pushVlan, vlanId, doTMAC);
if (fob == null) {
// error encountered during build
return false;
@@ -1006,7 +1023,7 @@
}
private FilteringObjective.Builder buildFilteringObjective(DeviceId deviceId, PortNumber portnum,
- boolean pushVlan, VlanId vlanId) {
+ boolean pushVlan, VlanId vlanId, boolean doTMAC) {
MacAddress deviceMac;
try {
deviceMac = config.getDeviceMac(deviceId);
@@ -1015,9 +1032,15 @@
return null;
}
FilteringObjective.Builder fob = DefaultFilteringObjective.builder();
- fob.withKey(Criteria.matchInPort(portnum))
- .addCondition(Criteria.matchEthDst(deviceMac))
- .withPriority(SegmentRoutingService.DEFAULT_PRIORITY);
+
+ if (doTMAC) {
+ fob.withKey(Criteria.matchInPort(portnum))
+ .addCondition(Criteria.matchEthDst(deviceMac))
+ .withPriority(SegmentRoutingService.DEFAULT_PRIORITY);
+ } else {
+ fob.withKey(Criteria.matchInPort(portnum))
+ .withPriority(SegmentRoutingService.DEFAULT_PRIORITY);
+ }
TrafficTreatment.Builder tBuilder = DefaultTrafficTreatment.builder();
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 55e16b4..94c8331 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
@@ -497,7 +497,7 @@
if (ethCriterion == null || ethCriterion.mac().equals(NONE)) {
// NOTE: it is possible that a filtering objective only has vidCriterion
- log.warn("filtering objective missing dstMac, cannot program TMAC table");
+ log.debug("filtering objective missing dstMac, won't program TMAC table");
} else {
MacAddress unicastMac = readEthDstFromTreatment(filt.meta());
List<List<FlowRule>> allStages = processEthDstFilter(portCriterion, ethCriterion,