import java.util.Collections;
import java.util.Iterator;
import java.util.List;
-import java.util.concurrent.atomic.AtomicInteger;
import javax.annotation.Nullable;
import org.apache.commons.lang3.tuple.Pair;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNode;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-/**
- * Created by Martin Bobak <mbobak@cisco.com> on 8.4.2015.
- */
public final class FlowUtil {
-
- private static final String ALIEN_SYSTEM_FLOW_ID = "#UF$TABLE*";
- private static final AtomicInteger unaccountedFlowsCounter = new AtomicInteger(0);
private static final Logger LOG = LoggerFactory.getLogger(FlowUtil.class);
private static final RpcResultBuilder<List<BatchFailedFlowsOutput>> SUCCESSFUL_FLOW_OUTPUT_RPC_RESULT =
RpcResultBuilder.success(Collections.<BatchFailedFlowsOutput>emptyList());
- /** Attach barrier response to given {@link RpcResult}<RemoveFlowsBatchOutput> */
+ /**
+ * Attach barrier response to given {@link RpcResult}<RemoveFlowsBatchOutput>
+ */
public static final Function<Pair<RpcResult<RemoveFlowsBatchOutput>, RpcResult<Void>>, RpcResult<RemoveFlowsBatchOutput>>
FLOW_REMOVE_COMPOSING_TRANSFORM = createComposingFunction();
- /** Attach barrier response to given {@link RpcResult}<AddFlowsBatchOutput> */
+ /**
+ * Attach barrier response to given {@link RpcResult}<AddFlowsBatchOutput>
+ */
public static final Function<Pair<RpcResult<AddFlowsBatchOutput>, RpcResult<Void>>, RpcResult<AddFlowsBatchOutput>>
FLOW_ADD_COMPOSING_TRANSFORM = createComposingFunction();
- /** Attach barrier response to given {@link RpcResult}<UpdateFlowsBatchOutput> */
+ /**
+ * Attach barrier response to given {@link RpcResult}<UpdateFlowsBatchOutput>
+ */
public static final Function<Pair<RpcResult<UpdateFlowsBatchOutput>, RpcResult<Void>>, RpcResult<UpdateFlowsBatchOutput>>
FLOW_UPDATE_COMPOSING_TRANSFORM = createComposingFunction();
return resultBld;
}
- public static FlowId createAlienFlowId(final short tableId) {
- final StringBuilder sBuilder = new StringBuilder(ALIEN_SYSTEM_FLOW_ID)
- .append(tableId).append('-').append(unaccountedFlowsCounter.incrementAndGet());
- String alienId = sBuilder.toString();
- return new FlowId(alienId);
-
- }
-
/**
* Factory method: create {@link Function} which attaches barrier response to given {@link RpcResult}<T>
* and changes success flag if needed.
}
/**
+ * Build flow path flow ref.
+ *
* @param nodePath path to {@link Node}
* @param tableId path to {@link Table} under {@link Node}
* @param flowId path to {@link Flow} under {@link Table}
* Factory method: creates {@link Function} which keeps info of original inputs (passed to flow-rpc) and processes
* list of all flow-rpc results.
*
- * @param inputBatchFlows collection of problematic flow-ids wrapped in container of given type <O>
* @param <O> result container type
+ * @param inputBatchFlows collection of problematic flow-ids wrapped in container of given type <O>
* @return static reusable function
*/
public static <O> Function<List<RpcResult<O>>, RpcResult<List<BatchFailedFlowsOutput>>> createCumulatingFunction(