Ask Your Question
0

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

2 answers

Sort by ยป oldest newest most voted
1

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
0

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

Comments

Have the same issue. Did you figure this?

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

Stats

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

Seen: 679 times

Last updated: Sep 15 '14