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 @@ ...@@ -15,16 +15,14 @@
15 */ 15 */
16 package org.onosproject.proxyarp; 16 package org.onosproject.proxyarp;
17 17
18 -import static org.slf4j.LoggerFactory.getLogger;
19 -
20 import org.apache.felix.scr.annotations.Activate; 18 import org.apache.felix.scr.annotations.Activate;
21 import org.apache.felix.scr.annotations.Component; 19 import org.apache.felix.scr.annotations.Component;
22 import org.apache.felix.scr.annotations.Deactivate; 20 import org.apache.felix.scr.annotations.Deactivate;
23 import org.apache.felix.scr.annotations.Reference; 21 import org.apache.felix.scr.annotations.Reference;
24 import org.apache.felix.scr.annotations.ReferenceCardinality; 22 import org.apache.felix.scr.annotations.ReferenceCardinality;
25 import org.onlab.packet.Ethernet; 23 import org.onlab.packet.Ethernet;
26 -import org.onlab.packet.IPv6;
27 import org.onlab.packet.ICMP6; 24 import org.onlab.packet.ICMP6;
25 +import org.onlab.packet.IPv6;
28 import org.onosproject.core.ApplicationId; 26 import org.onosproject.core.ApplicationId;
29 import org.onosproject.core.CoreService; 27 import org.onosproject.core.CoreService;
30 import org.onosproject.net.flow.DefaultTrafficSelector; 28 import org.onosproject.net.flow.DefaultTrafficSelector;
...@@ -36,6 +34,8 @@ import org.onosproject.net.packet.PacketService; ...@@ -36,6 +34,8 @@ import org.onosproject.net.packet.PacketService;
36 import org.onosproject.net.proxyarp.ProxyArpService; 34 import org.onosproject.net.proxyarp.ProxyArpService;
37 import org.slf4j.Logger; 35 import org.slf4j.Logger;
38 36
37 +import static org.slf4j.LoggerFactory.getLogger;
38 +
39 /** 39 /**
40 * Sample reactive proxy arp application. 40 * Sample reactive proxy arp application.
41 */ 41 */
......
...@@ -368,7 +368,7 @@ public class FlowRuleManager ...@@ -368,7 +368,7 @@ public class FlowRuleManager
368 extraneousFlow(rule); 368 extraneousFlow(rule);
369 } 369 }
370 } catch (Throwable e) { 370 } catch (Throwable e) {
371 - log.debug("Can't add missing flow rule {}", e.getMessage()); 371 + log.debug("Can't process added or extra rule {}", e.getMessage());
372 continue; 372 continue;
373 } 373 }
374 } 374 }
......
...@@ -108,6 +108,33 @@ implements PacketService, PacketProviderRegistry { ...@@ -108,6 +108,33 @@ implements PacketService, PacketProviderRegistry {
108 return appId; 108 return appId;
109 } 109 }
110 110
111 + @Override
112 + public boolean equals(Object o) {
113 + if (this == o) {
114 + return true;
115 + }
116 + if (o == null || getClass() != o.getClass()) {
117 + return false;
118 + }
119 +
120 + PacketRequest that = (PacketRequest) o;
121 +
122 + if (priority != that.priority) {
123 + return false;
124 + }
125 + if (!selector.equals(that.selector)) {
126 + return false;
127 + }
128 +
129 + return true;
130 + }
131 +
132 + @Override
133 + public int hashCode() {
134 + int result = selector.hashCode();
135 + result = 31 * result + priority.hashCode();
136 + return result;
137 + }
111 } 138 }
112 139
113 @Activate 140 @Activate
......