Hi,

datapath.send_msg() seems to compose OpenFlow message per single TCP packet.

https://github.com/osrg/ryu/blob/5bde6ae440c6aa67dafe02b5ad1cd2d933ee4350/ryu/controller/controller.py#L404-L410

If you want to compose multiple OpenFlow messages into a single TCP packet, you need 
to use "low
level" API datapath.send() instead of datapath.send_msg().

For example;

        out1 = parser.OFPPacketOut(...)  # if you have two PacketOut messages
        out2 = parser.OFPPacketOut(...)

        buf = b''
        for out in [out1, out2]:
            # handle xid and serialization manually
            if out.xid is None:
                datapath.set_xid(out)
            out.serialize()
            buf += out.buf  # combine messages into single binary

        datapath.send(buf)


Thanks,
Iwase


On 2017年11月02日 14:03, nitish nagesh wrote:
Hi,

   I am trying to write a script which could generate a packet with multiple PACKET_OUT messages bundled within it. For example something like this:

Inline image 1

I have this sample script which successfully generates a single PKT OUT message.

/@set_ev_cls(ofp_event.EventOFPPacketIn, MAIN_DISPATCHER)
     def _packet_in_handler(self, ev):
         msg = ev.msg
         datapath = msg.datapath
         ofproto = datapath.ofproto
         parser = datapath.ofproto_parser
         in_port = msg.match['in_port']

         if (in_port == 3):
            out_port = 2
            in_port = ofproto.OFPP_CONTROLLER
         else:
            out_port = 3

         actions = [parser.OFPActionOutput(out_port)]
         data = msg.data
         out = parser.OFPPacketOut(datapath=datapath, buffer_id=msg.buffer_id,
                                   in_port=in_port, actions=actions, data=data)
         datapath.send_msg(out)
/
  If i change the "actons" & call datapath.send() again, it ends up generating 2 PKT OUT messages in different packets. How do i change the code so that it bundles them together into one packet. Can you please help me out?

Thanks in advance


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot



_______________________________________________
Ryu-devel mailing list
Ryu-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ryu-devel


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Ryu-devel mailing list
Ryu-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ryu-devel

Reply via email to