ONOS-1926: Handle unsupported match field
Following is the main idea of this approach.
An UnsupportedOperationException indicates that:
1. The OF version is not supported (other than OF10 and OF13)
2. The flow contains unsupported match field
(e.g. install ICMPv6 match to an OF10 switch)
I believe retrying are not going to help in both cases.
Therefore, I directly change the flow state into FAILED.
In case 2, if the switch is reconnected/reconfigured with correct
OF version, the flow will be reinstalled to the switch correctly.
Change-Id: I954f3597a77934e46695b82a6d17363d41636ebe
diff --git a/core/net/src/main/java/org/onosproject/net/flow/impl/FlowRuleManager.java b/core/net/src/main/java/org/onosproject/net/flow/impl/FlowRuleManager.java
index 58ab91f..59048cd 100644
--- a/core/net/src/main/java/org/onosproject/net/flow/impl/FlowRuleManager.java
+++ b/core/net/src/main/java/org/onosproject/net/flow/impl/FlowRuleManager.java
@@ -41,6 +41,7 @@
import org.onosproject.net.DeviceId;
import org.onosproject.net.device.DeviceService;
import org.onosproject.net.flow.CompletedBatchOperation;
+import org.onosproject.net.flow.DefaultFlowEntry;
import org.onosproject.net.flow.FlowEntry;
import org.onosproject.net.flow.FlowRule;
import org.onosproject.net.flow.FlowRuleBatchEntry;
@@ -304,7 +305,14 @@
break;
case ADDED:
case PENDING_ADD:
- frp.applyFlowRule(flowRule);
+ try {
+ frp.applyFlowRule(flowRule);
+ } catch (UnsupportedOperationException e) {
+ log.warn(e.getMessage());
+ if (flowRule instanceof DefaultFlowEntry) {
+ ((DefaultFlowEntry) flowRule).setState(FlowEntry.FlowEntryState.FAILED);
+ }
+ }
break;
default:
log.debug("Flow {} has not been installed.", flowRule);