X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=utils%2Fmdsal-openflow%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fovsdb%2Futils%2Fmdsal%2Fopenflow%2FFlowUtils.java;h=74fea32479bf269bc184ff771c0d5a82cb35227b;hb=167d2bf5a154baf68f9c507341e44ad346433f04;hp=f916026f33ca37d125907a559fb14bec266277db;hpb=f82f508f9aa979b6f22b853f6c3e3899c47ea8a9;p=netvirt.git diff --git a/utils/mdsal-openflow/src/main/java/org/opendaylight/ovsdb/utils/mdsal/openflow/FlowUtils.java b/utils/mdsal-openflow/src/main/java/org/opendaylight/ovsdb/utils/mdsal/openflow/FlowUtils.java index f916026f33..74fea32479 100644 --- a/utils/mdsal-openflow/src/main/java/org/opendaylight/ovsdb/utils/mdsal/openflow/FlowUtils.java +++ b/utils/mdsal-openflow/src/main/java/org/opendaylight/ovsdb/utils/mdsal/openflow/FlowUtils.java @@ -19,7 +19,6 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.ta import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.Flow; import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.FlowBuilder; import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.FlowKey; -import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.OutputPortValues; import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.MatchBuilder; import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeConnectorId; import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeId; @@ -101,17 +100,31 @@ public class FlowUtils { FlowBuilder flowBuilder = new FlowBuilder(); flowBuilder.setMatch(new MatchBuilder().build()); - String flowId = "DEFAULT_PIPELINE_FLOW_" + table; - flowBuilder.setId(new FlowId(flowId)); - FlowKey key = new FlowKey(new FlowId(flowId)); - flowBuilder.setStrict(true); - flowBuilder.setBarrier(false); - flowBuilder.setTableId(table); - flowBuilder.setKey(key); - flowBuilder.setFlowName(flowId); - flowBuilder.setHardTimeout(0); - flowBuilder.setIdleTimeout(0); - flowBuilder.setPriority(0); + String flowName = "DEFAULT_PIPELINE_FLOW_" + table; + return initFlowBuilder(flowBuilder, flowName, table) + .setPriority(0); + } + + /** + * Sets up common defaults for the given flow builder: a flow identifier and key based on the given flow name, + * strict, no barrier, the given table identifier, no hard timeout and no idle timeout. + * + * @param flowBuilder The flow builder. + * @param flowName The flow name. + * @param table The table. + * @return The flow builder. + */ + public static FlowBuilder initFlowBuilder(FlowBuilder flowBuilder, String flowName, short table) { + final FlowId flowId = new FlowId(flowName); + flowBuilder + .setId(flowId) + .setStrict(true) + .setBarrier(false) + .setTableId(table) + .setKey(new FlowKey(flowId)) + .setFlowName(flowName) + .setHardTimeout(0) + .setIdleTimeout(0); return flowBuilder; } }