Charles M.C. Chan
Committed by Gerrit Code Review

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
...@@ -41,6 +41,7 @@ import org.onosproject.net.Device; ...@@ -41,6 +41,7 @@ import org.onosproject.net.Device;
41 import org.onosproject.net.DeviceId; 41 import org.onosproject.net.DeviceId;
42 import org.onosproject.net.device.DeviceService; 42 import org.onosproject.net.device.DeviceService;
43 import org.onosproject.net.flow.CompletedBatchOperation; 43 import org.onosproject.net.flow.CompletedBatchOperation;
44 +import org.onosproject.net.flow.DefaultFlowEntry;
44 import org.onosproject.net.flow.FlowEntry; 45 import org.onosproject.net.flow.FlowEntry;
45 import org.onosproject.net.flow.FlowRule; 46 import org.onosproject.net.flow.FlowRule;
46 import org.onosproject.net.flow.FlowRuleBatchEntry; 47 import org.onosproject.net.flow.FlowRuleBatchEntry;
...@@ -304,7 +305,14 @@ public class FlowRuleManager ...@@ -304,7 +305,14 @@ public class FlowRuleManager
304 break; 305 break;
305 case ADDED: 306 case ADDED:
306 case PENDING_ADD: 307 case PENDING_ADD:
308 + try {
307 frp.applyFlowRule(flowRule); 309 frp.applyFlowRule(flowRule);
310 + } catch (UnsupportedOperationException e) {
311 + log.warn(e.getMessage());
312 + if (flowRule instanceof DefaultFlowEntry) {
313 + ((DefaultFlowEntry) flowRule).setState(FlowEntry.FlowEntryState.FAILED);
314 + }
315 + }
308 break; 316 break;
309 default: 317 default:
310 log.debug("Flow {} has not been installed.", flowRule); 318 log.debug("Flow {} has not been installed.", flowRule);
......