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


Flow not installed in switch.

asked 2017-09-14 11:45:12 -0800


I use the following code snippet to install a flow in a switch:

  FlowEntityBuilder flowEntityBuilder = new FlowEntityBuilder();

MatchInfo matchInfo = new MatchEthernetSource(macAddress);

InstructionInfo instructionInfo = new InstructionGotoTable(tableId);
FlowEntity flowEntity = flowEntityBuilder.addInstructionInfoList(instructionInfo).addMatchInfoList(matchInfo).build();

I connect with mininet but when I go to look at the flow, I do not see anything. No execptions thrown. How can I debug such problems? Any pointers appreciated. Thanks

edit retag flag offensive close merge delete


Can you check your config datastore for the flow entry?

sunilkumarms ( 2017-09-14 22:14:13 -0800 )edit

I'm not used to these plugins. I use SalFlowService (examples exist on l2switch). Is MdsalApiManager quite different?

VincentJahjah ( 2017-09-15 05:11:38 -0800 )edit

@sunilkumarms How can I check the config datastore ? I am just getting into this so any pointers appreciated. Thank you.

mranga ( 2017-09-16 15:33:39 -0800 )edit

use the REST URL http://<controller_ip_address>:<controller_port>/restconf/config/opendaylight-inventory:nodes from any of the rest client to get the output and also capture packets between controller and mininet using wireshark

sunilkumarms ( 2017-09-20 00:29:11 -0800 )edit

1 answer

Sort by ยป oldest newest most voted

answered 2017-09-16 17:13:20 -0800

After some hacking, I finally got it to work. Here's what I had to do:

In my provider I have :

    public SdnmudProvider(final DataBroker dataBroker, SalFlowService flowService,
        PacketProcessingService packetProcessingService, NotificationService notificationService,
        IMdsalApiManager mdsalApiManager) {
    this.dataBroker = dataBroker;
    this.flowService = flowService;
    this.packetProcessingService = packetProcessingService;
    this.notificationService = notificationService;
    this.mdsalApiManager = mdsalApiManager;


 private static InstanceIdentifier<?> getWildcardPath() {
      return InstanceIdentifier.create(Nodes.class).child(Node.class).augmentation(FlowCapableNode.class);

         * Method called when the blueprint container is created.
public void init() {"SdnmudProvider Session Initiated");
    FlowCommitWrapper flowCommitWrapper = new FlowCommitWrapper(dataBroker, mdsalApiManager, flowService);
    SdnMudHandler sdnMudHandler = new SdnMudHandler(flowCommitWrapper);
    WakeupOnFlowCapableNode wakeupListener = new WakeupOnFlowCapableNode(sdnMudHandler);

    final InstanceIdentifier<Table> instanceIdentifier = InstanceIdentifier.builder(Nodes.class).child(Node.class)

    final DataTreeIdentifier<FlowCapableNode> dataTreeIdentifier = new DataTreeIdentifier(LogicalDatastoreType.OPERATIONAL, getWildcardPath());

    this.dataTreeChangeListenerRegistration = this.dataBroker.registerDataTreeChangeListener(dataTreeIdentifier,

            new PacketInDispatcherImpl(sdnMudHandler, mdsalApiManager, flowCommitWrapper));"start() <--");


The key seems to be to generate the right DataTreeIdentifier.

Then I install the flow using the following when the switch appears.

      public void writeFlow(FlowBuilder flow, InstanceIdentifier<FlowCapableNode> flowNodeIdent) {

    ReadWriteTransaction modification = dataBrokerService.newReadWriteTransaction();
    final InstanceIdentifier<Flow> path1 = flowNodeIdent.child(Table.class, new TableKey(flow.getTableId()))
            .child(Flow.class, flow.getKey());
    modification.merge(LogicalDatastoreType.CONFIGURATION, path1,, true);
    CheckedFuture<Void, TransactionCommitFailedException> commitFuture = modification.submit();
    Futures.addCallback(commitFuture, new FutureCallback<Void>() {
        public void onSuccess(Void aVoid) {
            LOG.debug("Write of flow on device succeeded.");

        public void onFailure(Throwable throwable) {
            LOG.error("Write of flow on device failed.", throwable);


Later when a packet arrives, I use this method to install other flows.

A bit verbose but it works (for now).

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

Question Tools

1 follower


Asked: 2017-09-14 11:45:12 -0800

Seen: 213 times

Last updated: Sep 16 '17