{"library":"ryu","title":"Ryu","description":"Ryu is a component-based software-defined networking (SDN) framework that provides a set of APIs for network applications to manage and control network devices. The current version is 4.34. It has a stable release cadence with occasional updates.","language":"python","status":"active","last_verified":"Fri May 01","install":{"commands":["pip install ryu"],"cli":{"name":"ryu-manager","version":""}},"imports":["from ryu.base import app_manager","from ryu.controller.handler import set_ev_cls"],"auth":{"required":false,"env_vars":[]},"quickstart":{"code":"from ryu.base import app_manager\nfrom ryu.controller import ofp_event\nfrom ryu.controller.handler import MAIN_DISPATCHER, set_ev_cls\nfrom ryu.ofproto import ofproto_v1_3\n\nclass MyController(app_manager.RyuApp):\n    OFP_VERSIONS = [ofproto_v1_3.OFP_VERSION]\n\n    @set_ev_cls(ofp_event.EventOFPSwitchFeatures, MAIN_DISPATCHER)\n    def switch_features_handler(self, ev):\n        datapath = ev.msg.datapath\n        ofproto = datapath.ofproto\n        parser = datapath.ofproto_parser\n        print(f\"Switch connected: {datapath.id}\")\n","lang":"python","description":"A minimal Ryu application that responds to switch connection events.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":null}