Opendaylight can send out barrier request when adding flow, but cannot do the same when removing flow.

asked 2015-07-06 01:09:01 -0700

Wendy gravatar image

Hello everyone,

I'm testing on adding/removing flow. Because my flow is quite a lot, I need a barrier message after every FLOWMOD packet. I build and write the flow with "setBarrier(true)", as followings, and Opendaylight can send barrier after FLOWADD. But in the same way it won't send out barrier after FLOW_DELETE.

Does anyone know the barrier setting for removing flow, or is it an existed bug that hasn't been fixed?

Thank you all very much for your kindly help!

Coding detail:

    private Flow createLldpToControllerFlow(Short tableId) {

    FlowBuilder lldpFlow = new FlowBuilder() 
            .setTableId(tableId) 
            .setFlowName("lldptocntrl");

    /* ignore the detail building here */

    lldpFlow.setMatch(match) 
            .setInstructions(new InstructionsBuilder() 
                    .setInstruction(ImmutableList.of(applyActionsInstruction)) 
                    .build()) 
            .setPriority(FlowPriority) 
            .setBufferId(0L) 
            .setBarrier(true) 
            .setHardTimeout(FlowHardTimeout) 
            .setIdleTimeout(FlowIdleTimeout) 
            .setCookie(new FlowCookie(BigInteger.valueOf(flowCookieInc.getAndIncrement())))
            .setFlags(new FlowModFlags(false, false, false, false, false));

    return lldpFlow.build();
}

After build this LLDP flow, I write the flow using:

    private void writeFlow(InstanceIdentifier<Node> nodePath, Short tableId,
                       long flowId, Flow flow) throws Exception {

    InstanceIdentifier<Table> TablePath = getTablePath(nodePath, tableId);
    InstanceIdentifier<Flow> flowPath = getFlowPath(TablePath, flowId);
    final AddFlowInputBuilder builder = new AddFlowInputBuilder(flow);
    builder.setNode(new NodeRef(nodePath));
    builder.setFlowRef(new FlowRef(flowPath));
    builder.setFlowTable(new FlowTableRef(TablePath));
    builder.setTransactionUri(new Uri(flow.getId().getValue()));
    builder.setBarrier(true);
    Future<RpcResult<AddFlowOutput>> resultFuture = salFlowService.addFlow(builder.build()); 
    RpcResult<AddFlowOutput> result = resultFuture.get(); 
    _logger.trace("writeFlow result: {}", result.isSuccessful());
}

Removal is the similar:

    private void removeFlow(InstanceIdentifier<Node> nodePath, Short tableId,
                        long flowId, Flow flow) throws Exception {

    InstanceIdentifier<Table> TablePath = getTablePath(nodePath, tableId);
    InstanceIdentifier<Flow> flowPath = getFlowPath(TablePath, flowId);
    final RemoveFlowInputBuilder builder = new RemoveFlowInputBuilder(flow);
    builder.setNode(new NodeRef(nodePath));
    builder.setFlowRef(new FlowRef(flowPath));
    builder.setFlowTable(new FlowTableRef(TablePath));
    builder.setTransactionUri(new Uri(flow.getId().getValue()));
    builder.setBarrier(true);
    Future<RpcResult<RemoveFlowOutput>> resultFuture = salFlowService.removeFlow(builder.build());
    RpcResult<RemoveFlowOutput> result = resultFuture.get();
    _logger.trace("removeFlow result: {}", result.isSuccessful());
}
edit retag flag offensive close merge delete