Hello all,
I have an SDN application that I have written using Pox, that I am now trying
to rewrite for Ryu, due to the OpenFlow 1.3 support.
My Pox application receives packets from the Pox controller’s network card (not
connected to the SDN data plane), and using the information in these packets to
make changes to the SDN data plane.
To do this in Pox, I wrote a separate Pox application to receive the packets
which ran in a different thread (to stop blocking), that then triggered events
to allow the main Pox application to receive the packet’s data.
Network as follows:
[Packet sender with actionable information]
↓
[Ethernet 1]
↓
[Ryu Machine]
↓
[Ethernet 2]
↓
[Data plane]
To do this in Pox the packet receiving application was as follows:
# -*- coding: utf-8 -*-
# Copyright 2019 Matthew Robinson, STRI, University of Hertfordshire.
#
"""
A POX component that receives routing information from Matlab.
This calls an event that the main POX application can listen to.
Threading is used to stop blocking while listening to the UDP socket.
"""
from pox.core import core
from pox.lib.revent import *
import socket
import threading
log = core.getLogger()
class ReceiveEvent (Event):
"""
Receive event.
This is the event that we can trigger for our main application to act on.
"""
def __init__(self, multicast_path):
self.multicast_path = multicast_path # We are just putting the path
data into event.multicast_path.
class RX (EventMixin):
"""
The component that is launched by the launch function.
EventMixin means it can trigger events.
"""
_core_name = "RX" # The name of this module.
_eventMixin_events = set([ # Telling POX that that ReceiveEvent is an
Event function.
ReceiveEvent,
])
def __init__ (self, port, ip): # The IP and port for our Matlab connection.
self.port = port
self.ip = ip
self.sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) # The UDP
socket to receive from.
self.sock.bind((self.ip, self.port))
self.listen = threading.Thread(target=self._check_rx) # Starting a
Thread so the socket can be
self.listen.start() # checked
continuously in parallel to POX.
def _check_rx(self): # This is the
Thread that is started.
while True: #
Continuously check if data is available
data, addr = self.sock.recvfrom(1024) # from the UDP port.
self.raiseEventNoErrors(ReceiveEvent, data) # If it is
available, raise the event function above.
def launch (ip = '192.168.56.1', port = 10000): # This function is called
by POX to start the
ip = ip # component.
port = port # Register the component
with POX.
core.registerNew(RX, port = port, ip = ip)
This approach do not work in Ryu however. Can anyone offer me some advice in
how to receive data from an outside source to a Ryu application?
Is it possible that Ryu does not accept creating a python socket within it’s
applications? Or is it possible that Ryu does not allow threads to be started?
Thanks for your time,
Regards,
Matthew
This email has been scanned by BullGuard antivirus protection.
For more info visit
www.bullguard.com<http://www.bullguard.com/tracking.aspx?affiliate=bullguard&buyaffiliate=smtp&url=/>
_______________________________________________
Ryu-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ryu-devel