os-ken

raw JSON →
4.1.1 verified Mon Apr 27 auth: no python

A component-based software defined networking framework for OpenStack, currently at version 4.1.1. It is actively maintained with a focus on SDN controller development.

pip install os-ken
error ModuleNotFoundError: No module named 'ryu'
cause Code written for Ryu imported under 'ryu' instead of 'os_ken'.
fix
Replace import ryu with import os_ken.
error ImportError: cannot import name 'RyuApp' from 'os_ken.base.app_manager'
cause Base class renamed from RyuApp to OSKenApp.
fix
Use 'from os_ken.base.app_manager import OSKenApp'.
error RuntimeError: Python version <3.10 not supported
cause os-ken 4.x requires Python 3.10+.
fix
Upgrade Python to 3.10 or later, or install os-ken 3.x with pip install os-ken==3.6.0.
breaking Python 3.10+ required; os-ken 4.x drops Python 3.8/3.9 support.
fix Use Python 3.10 or later, or pin to os-ken 3.x if older Python needed.
breaking Renamed base app class from RyuApp to OSKenApp; all Ryu imports broken.
fix Replace 'ryu' with 'os_ken' in imports and RyuApp with OSKenApp.
gotcha os-ken uses same OF-Config and OpenFlow libraries as Ryu but with different module paths.
fix Always import from os_ken not ryu; check os_ken documentation for exact paths.
deprecated Some Ryu extension modules (e.g., ryu.topology) may not be fully ported; use os_ken.topology.
fix Check if the extension is available under os_ken; fallback to lower version if needed.

Simple SDN controller app that prints switch ID on connection.

from os_ken.base.app_manager import OSKenApp
from os_ken.controller.handler import set_ev_cls
from os_ken.ofproto.ofproto_v1_3 import OFPFlowMod

class SimpleSwitch(OSKenApp):
    @set_ev_cls(OFPFlowMod)
    def switch_features_handler(self, ev):
        msg = ev.msg
        print(f"Switch {msg.datapath.id} connected")

if __name__ == '__main__':
    from os_ken.cmd.manager import Controller
    c = Controller()
    c.start()