Ask is moving to Stack Overflow and! Please use the "opendaylight" tag on either of these sites. This site is now in Read-Only mode


Not able to add Flood flow on Table 0

asked 2016-10-04 13:49:55 -0700

ahuja gravatar image


I am trying to add flow via the following code:

        MacAddress macAddress = new MacAddress("FF:FF:FF:FF:FF:FF");
        MatchBuilder matchBuilder = new MatchBuilder();

        EthernetMatchBuilder ethernetMatchBuilder = new EthernetMatchBuilder();

        EthernetDestinationBuilder ethernetDestinationBuilder = new EthernetDestinationBuilder();




        //add flow to flood the frame with priority 0

        InstructionsBuilder isb = new InstructionsBuilder();
        InstructionBuilder ib = new InstructionBuilder();
        List<Instruction> instructions = new ArrayList<Instruction>();

        ApplyActionsBuilder applyActionsBuilder= new ApplyActionsBuilder();
        List<Action> actionList = new ArrayList<Action>();

        // action to Flood the Frame
        ActionBuilder abFlood= new ActionBuilder();
        OutputActionBuilder outputActionBuilderFlood = new OutputActionBuilder();
        Uri flood = new Uri(OutputPortValues.FLOOD.toString());
        abFlood.setAction(new OutputActionCaseBuilder().setOutputAction(;
        abFlood.setKey(new ActionKey(0));

        // now action list is ready

        //apply the actions

        // now wrap it into instructions
        ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(;

        FlowBuilder flow = new FlowBuilder();
        FlowId flowId = new FlowId("30");
        //flow.setCookie(new FlowCookie(106));

        **flow.setTableId((short) 1);**
        flow.setKey(new FlowKey(flowId));

           InstanceIdentifier<Flow> flowIID = InstanceIdentifier.builder(Nodes.class)
                .child(Node.class, new NodeKey(nodeId))
                .child(Table.class, new TableKey(flow.getTableId()))
                .child(Flow.class, flow.getKey())

           //now the actual writing
           GenericTransactionUtils.writeData(dataBroker, LogicalDatastoreType.CONFIGURATION, flowIID,, true);
           catch (Exception e){
            System.out.println("error in writing flow" + e);
           System.out.println("Flood Flow written");

Here the table id is 1. It can add flow now. Once i change the table id to 0, the flow is added to confrontational datastore but not to operational datastore. Hence, I am not able to the flow on my switch. However, if I try to add this same flow via Restconf to table 0, I am able to do it.

Please let me know what I am doing wrong here. Also, If you feel there is some better way to add flow, please let me know.


edit retag flag offensive close merge delete


Can anyone provide any lead on this?

ahuja ( 2016-10-18 09:54:15 -0700 )edit

@ahuja I'm not sure to completely follow your issue. You can add flow to table 1 but can't add flow to table 0? Using the same code with a different table id?

adetalhouet ( 2016-10-21 06:51:51 -0700 )edit

I appreciate your help to resolve the issue. Yes, this is the same thing happening. Any flow I am trying to add (whether it be flow for flooding or to go to next table), I am not able to add to table 0. If I replace the table id by 1 or 2 or any other number except 0, I am able to add the flow.

ahuja ( 2016-10-24 13:58:00 -0700 )edit

If I use table id as 0, its get written to the config datastore but not to the operational datastore. If I use some other table id, its get written to the config datastore, and gets reflected on the operational datastore too.

ahuja ( 2016-10-24 14:52:55 -0700 )edit

@ahuja, could this be a device restriction? Do you have logs associated with that, when it failed to write to operational datastore?

adetalhouet ( 2016-10-31 10:31:43 -0700 )edit

2 answers

Sort by ยป oldest newest most voted

answered 2016-10-31 11:27:40 -0700

jamoluhrsen gravatar image

one interesting comment in the original question was that the flow was successfully added to the switch via restconf using table 0, but the java method failed.

would it be possible to sniff the traffic between ODL and the switch when you are having trouble? do you see a flowmod sent down to the switch? if so, compare the flowmods between the restconf method and the java method. If not, then we can probably assume some trouble in the java method itself.

edit flag offensive delete publish link more


When I run wireshark on my Mininet switch, I see everything perfect. The Flow Mod message has Table id 0 and Got To Table action as table id 1.

ahuja ( 2016-11-01 09:36:58 -0700 )edit

Also, I did one more change.I tried to install my Flood flow in table 0 instead of table 2, it didnt get installed. On wireshark its the same thing. The Flow Mod message shows table id as 0.

ahuja ( 2016-11-01 09:37:10 -0700 )edit

But when I install the flow from Restconf, it gets installed. The strange part the Flod Mod message is similar to the Flow Mod msg got via Java code.

ahuja ( 2016-11-01 09:37:22 -0700 )edit

@jamoluhrsen I took wireshark captures while adding flow from Restconf and java Code. there was a difference. The difference is appended as my answer.

ahuja ( 2016-11-08 09:05:04 -0700 )edit

There was a big blunder. My another api was deleting the flows in table 0. After analyzing the wireshark captures, I was able to solve this.

ahuja ( 2016-11-22 07:04:48 -0700 )edit

answered 2016-11-08 09:07:33 -0700

ahuja gravatar image

updated 2016-11-08 09:40:01 -0700

Wireshark capture while adding flow via Restconf: Please note the COMMAND image description

Wireshark capture while adding flow via Java Code: Please note the COMMAND image description

I am using the Java code similar to one mentioned in my question.

There is one more comparison if it helps. I tired to add flood flow on table 2 and table 0. The two wireshark captures are: Table id 2 flow I was able to find in the switch but not with table id 0.

with table id 2: image description

with table id 0: image description

edit flag offensive delete publish link more
Login/Signup to Answer


Asked: 2016-10-04 13:49:55 -0700

Seen: 154 times

Last updated: Nov 08 '16