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

0

Not able to add Flood flow on Table 0

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

ahuja gravatar image

Hi,

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();

        ethernetDestinationBuilder.setAddress(macAddress);

        ethernetMatchBuilder.setEthernetDestination(ethernetDestinationBuilder.build());

        matchBuilder.setEthernetMatch(ethernetMatchBuilder.build());

        //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());
        outputActionBuilderFlood.setOutputNodeConnector(flood);
        abFlood.setAction(new OutputActionCaseBuilder().setOutputAction(outputActionBuilderFlood.build()).build());
        abFlood.setOrder(0);
        abFlood.setKey(new ActionKey(0));


        // now action list is ready
        actionList.add(abFlood.build());

        //apply the actions
        applyActionsBuilder.setAction(actionList);

        // now wrap it into instructions
        ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(applyActionsBuilder.build()).build());
        ib.setOrder(0);
        instructions.add(ib.build());
        isb.setInstruction(instructions);


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

        flow.setFlowName("flood");
        flow.setIdleTimeout(0);
        flow.setHardTimeout(0);
        flow.setStrict(false);
        **flow.setTableId((short) 1);**
        flow.setPriority(30);
        flow.setInstructions(isb.build());
        flow.setKey(new FlowKey(flowId));
        flow.setMatch(matchBuilder.build());

               @SuppressWarnings("deprecation")
           InstanceIdentifier<Flow> flowIID = InstanceIdentifier.builder(Nodes.class)
                .child(Node.class, new NodeKey(nodeId))
                .augmentation(FlowCapableNode.class)
                .child(Table.class, new TableKey(flow.getTableId()))
                .child(Flow.class, flow.getKey())
                .build();

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

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.

Thanks!

edit retag flag offensive close merge delete

Comments

Can anyone provide any lead on this?

ahuja ( 2016-10-18 09:54:15 -0800 )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 -0800 )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 -0800 )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 -0800 )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 -0800 )edit

2 answers

Sort by ยป oldest newest most voted
1

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

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

Comments

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 -0800 )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 -0800 )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 -0800 )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 -0800 )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 -0800 )edit
0

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

ahuja gravatar image

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

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

Stats

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

Seen: 105 times

Last updated: Nov 08 '16