BUG-6109: Having a null match field is totally fine. 05/41605/1
authorShuva Kar <shuva.jyoti.kar@ericsson.com>
Sat, 9 Jul 2016 01:55:51 +0000 (07:25 +0530)
committerShuva Kar <shuva.jyoti.kar@ericsson.com>
Sat, 9 Jul 2016 01:58:34 +0000 (07:28 +0530)
The ofplugin flow registry being modified to handle it in the newer
version of the ofplugin

Change-Id: I07c9b9941bcac2bd5cb82d84898b732bbfc21968
Signed-off-by: Shuva Kar <shuva.jyoti.kar@ericsson.com>
openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/registry/flow/FlowRegistryKeyFactory.java

index 195626bf28dd2c1c0066485ab77111ccd592dde1..1a9948a2bd1137036ce9af73f678550595784c57 100644 (file)
@@ -15,6 +15,7 @@ import org.opendaylight.openflowplugin.api.OFConstants;
 import org.opendaylight.openflowplugin.api.openflow.registry.flow.FlowRegistryKey;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.Flow;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.Match;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.MatchBuilder;
 
 /**
  * Created by Martin Bobak &lt;mbobak@cisco.com&gt; on 8.4.2015.
@@ -40,7 +41,7 @@ public class FlowRegistryKeyFactory {
             //TODO: mandatory flow input values (or default values) should be specified via yang model
             tableId = Preconditions.checkNotNull(flow.getTableId(), "flow tableId must not be null");
             priority = MoreObjects.firstNonNull(flow.getPriority(), OFConstants.DEFAULT_FLOW_PRIORITY);
-            match = Preconditions.checkNotNull(flow.getMatch(), "Match value must not be null");
+            match = flow.getMatch()==null? new MatchBuilder().build(): flow.getMatch();
             cookie = MoreObjects.firstNonNull(flow.getCookie(), OFConstants.DEFAULT_FLOW_COOKIE).getValue();
         }