I use ODL 0.2.3-Helium-SR3. I want to programmatically create a flow with an Apply Actions Instruction which contains one Set Vlan Id Action. This is the code I use:
List<Action> actionList = new ArrayList<Action>(); SetVlanIdActionCaseBuilder svacb = new SetVlanIdActionCaseBuilder(); SetVlanIdActionBuilder svab = new SetVlanIdActionBuilder(); svab.setVlanId(new VlanId(((SetVlanIdAction)action).getVlanId())); svacb.setSetVlanIdAction(svab.build()); actionBuilder.setAction(svacb.build()); actionBuilder.setOrder(actionOrderIdx); actionBuilder.setKey(new ActionKey(actionOrderIdx++)); odlActions.add(actionBuilder.build()); ApplyActionsBuilder applyActionsBuilder = new ApplyActionsBuilder(); applyActionsBuilder.setAction(odlActions); instructionBuilder.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(applyActionsBuilder.build()) .build());
The isntruction builder goes into a FlowBuilder.setInstructions() and this FlowBuilder is added as a Flow to an AddFlowInputBuilder which is passed to the SalFlowService.addFlow().
After doing this on a OF 1.3 switch created in Mininet, I cannot see the flow on the switch using the ovs-ofctl dump-flows command or using the ODL Rest API to see the switch's operational configuration.
I'd like to mention that if, for example I want to create an Output Action instead, the flow gets created on the switch. Or if I want to create the Set Vlan Id action on a 1.0 switch it also gets created.
I enabled TRACE logging on ODL and I see some interesting differences between adding a Set VlanId Action and adding an Output Action.
These are the lines of logging which are not present when adding the set vlan id but are when adding Output Action: 2015-07-29 15:03:44,177 | DEBUG | OFRpc-6 | OFRpcTaskFactory | 206 - org.opendaylight.openflowplugin - 0.0.6.Helium-SR3 | Number of flows to push to switch: 1
2015-07-29 15:03:44,177 | DEBUG | OFRpc-6 | MessageDispatchServiceImpl | 206 - org.opendaylight.openflowplugin - 0.0.6.Helium-SR3 | Calling OFLibrary flowMod
2015-07-29 15:03:44,180 | DEBUG | entLoopGroup-7-1 | FRpcFutureResultTransformFactory | 206 - org.opendaylight.openflowplugin - 0.0.6.Helium-SR3 | Returning the Add Flow RPC result to MD-SAL
It looks to me like when adding the set vlan id action, the RPC Task is never called for some reason and the message is not received by the switch.
Can anybody give me some advice on what am I missing?