Dear Ryu developers,

I'm trying to initiate the sending of a packet from within a Ryu app but
not sure how to do it right. The main problem is that I'm not sure how to
create a new Datapath/OFPPacketIn event object so that I can send an event.
Right now I have the following code snippet:

from ryu.base import app_manager
from ryu.controller import ofp_event
from ryu.lib.packet import ethernet, ipv4, icmp
from ryu.ofproto import ofproto_v1_3


class RyuEventSender(app_manager.RyuApp):
    OFP_VERSIONS = [ofproto_v1_3.OFP_VERSION]

    def send_packet(self):
        pkt = ethernet.ethernet(dst='5e:cc:cc:b1:49:4b') / \
              ipv4.ipv4(src='192.168.70.2',
                        dst='192.168.70.3',
                        proto=1) / \
              icmp.icmp()
        pkt.serialize()

        ev = ...  # Create an ofp_event.EventOFPPacketIn event
        self.send_event_to_observers(ev)
        print('[SENDER]:', ev.msg)

    def start(self):
        super().start()
        self.send_packet()

Can you point me to how to create a Datapath object or a valid OFPPacketIn
event or any other way of sending a packet from within Ryu?

Thanks in advance.
Best,
Martin
_______________________________________________
Ryu-devel mailing list
Ryu-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ryu-devel

Reply via email to