+ public static def toMDFlow(Flow sourceFlow, String flowId) {
+ if (sourceFlow == null)
+ throw new IllegalArgumentException();
+ val it = new FlowBuilder();
+ hardTimeout = sourceFlow.hardTimeout as int
+ idleTimeout = sourceFlow.idleTimeout as int
+ cookie = BigInteger.valueOf(sourceFlow.id)
+ priority = sourceFlow.priority as int
+ id = new FlowId(flowId)
+
+ val sourceActions = sourceFlow.actions;
+ val targetActions = new ArrayList<Action>();
+ for (sourceAction : sourceActions) {
+ targetActions.add(sourceAction.toAction());
+ }
+ instructions = targetActions.toApplyInstruction();
+ match = sourceFlow.match.toMatch();
+ tableId = new Integer(0).shortValue
+ return it.build();
+ }
+