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


How to handle/parse OpenFlow message.

asked 2014-09-09 04:56:38 -0700

haczyk130 gravatar image

updated 2014-09-15 04:27:23 -0700

Hi, I have a simple mininet network. I found the application that handle a packets when I ping from one host to another. This work properly (IP addres is displaying). Now I want to change this program to handle a OpenFlow message when for eg. link between switches goes down. In wireshark I see that switch sended a OFPTPORTSTATUS message. How to handle this message (maybe use diffrent interface than IListenDataPacket and reciveDataPacket() functions)? How to get this message type? Below I attachedreceiveDataPacket code. Thanks for help.

@Override public PacketResult receiveDataPacket(RawPacket inPkt) { log.trace("Received data packet.");

    // The connector, the packet came from ("port")
    NodeConnector ingressConnector = inPkt.getIncomingNodeConnector();
    // The node that received the packet ("switch")
    Node node = ingressConnector.getNode();

    // Use DataPacketService to decode the packet.
    Packet l2pkt = dataPacketService.decodeDataPacket(inPkt);

    if (l2pkt instanceof Ethernet) {
        Object l3Pkt = l2pkt.getPayload();
        if (l3Pkt instanceof IPv4) {
            IPv4 ipv4Pkt = (IPv4) l3Pkt;
            int dstAddr = ipv4Pkt.getDestinationAddress();
            InetAddress addr = intToInetAddress(dstAddr);
            System.out.println("Pkt. to " + addr.toString()
                    + " received by node " + node.getNodeIDString()
                    + " on connector "
                    + ingressConnector.getNodeConnectorIDString());
            return PacketResult.KEEP_PROCESSING;
    // We did not process the packet -> let someone else do the job.
    return PacketResult.IGNORED;

//EDIT Hi, I found that is an interface IMessageListener which allow to hande OFMessages. I make a dependecies in pom file and implement this interface. I build a bundle succesufully. I install it on controller, but when I try to start this an error is displaying: Reason: Missing Constraint: Import-Package: org.opendaylight.controller.protocol_plugin.openflow13.core; version="0.0.0" What can I do with this? Thanks for help.

//EDIT Anybody can help me?

edit retag flag offensive close merge delete


Hi haczyk130... You find out how to intercept an openflow message? You could tell me what i have to do, or where (or what i need) i could research? About your error: you tried add this API via maven - adding a dependency in pom file of your project? thanks... Any help is welcome...

almjr ( 2017-09-27 10:50:09 -0700 )edit

2 answers

Sort by ยป oldest newest most voted

answered 2014-09-11 00:45:59 -0700

michal.rehak gravatar image

Hi haczyk130,

this interface is part of old OFPlugin (supports OF-1.0 only). If you are running the base distribution from integration project then you probably need to start it with parameter -of10. This should expose old ofplugin bundles to osgi.

Regards, Michal

edit flag offensive delete publish link more

answered 2014-09-11 05:58:05 -0700

haczyk130 gravatar image

Hi, Michal thanks for your answer! I am new in Opendaylight. I do what you advice but it doesn't work. Now I have this error when try to start bundle: Missing Constraint: Import-Package: org.opendaylight.controller.protocol_plugin.openflow.core; version="[0.1.0,1.0.0)". In my app I want to handle the OF message senden by switch when link goes down. You said that IMessageListener is old interface, so can you tell me what interface should I use or where should I look for it? Thanks for help.

edit flag offensive delete publish link more


Have the same issue. Did you figure this?

luizana ( 2016-10-26 07:47:47 -0700 )edit
Login/Signup to Answer


Asked: 2014-09-09 04:56:38 -0700

Seen: 923 times

Last updated: Sep 15 '14