alshabib
Committed by Gerrit Code Review

fix for flows stuck in pending add state

Problem is due to two packet requests from different services
for the same selector resulting in the same flow rule.
Since these rules where the same, only one ended up on the data plane,
but sadly only the first request made it into the flow service meaning
that in cases where what was in the flow service does not match what is
on the dataplane resulting in a PENDING_ADD situation.

Change-Id: I4c03e753be6e198e04f0b5263a2aa8cf2edc51e1
......@@ -15,16 +15,14 @@
*/
package org.onosproject.proxyarp;
import static org.slf4j.LoggerFactory.getLogger;
import org.apache.felix.scr.annotations.Activate;
import org.apache.felix.scr.annotations.Component;
import org.apache.felix.scr.annotations.Deactivate;
import org.apache.felix.scr.annotations.Reference;
import org.apache.felix.scr.annotations.ReferenceCardinality;
import org.onlab.packet.Ethernet;
import org.onlab.packet.IPv6;
import org.onlab.packet.ICMP6;
import org.onlab.packet.IPv6;
import org.onosproject.core.ApplicationId;
import org.onosproject.core.CoreService;
import org.onosproject.net.flow.DefaultTrafficSelector;
......@@ -36,6 +34,8 @@ import org.onosproject.net.packet.PacketService;
import org.onosproject.net.proxyarp.ProxyArpService;
import org.slf4j.Logger;
import static org.slf4j.LoggerFactory.getLogger;
/**
* Sample reactive proxy arp application.
*/
......
......@@ -368,7 +368,7 @@ public class FlowRuleManager
extraneousFlow(rule);
}
} catch (Throwable e) {
log.debug("Can't add missing flow rule {}", e.getMessage());
log.debug("Can't process added or extra rule {}", e.getMessage());
continue;
}
}
......
......@@ -108,6 +108,33 @@ implements PacketService, PacketProviderRegistry {
return appId;
}
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
PacketRequest that = (PacketRequest) o;
if (priority != that.priority) {
return false;
}
if (!selector.equals(that.selector)) {
return false;
}
return true;
}
@Override
public int hashCode() {
int result = selector.hashCode();
result = 31 * result + priority.hashCode();
return result;
}
}
@Activate
......