ofp: use RyuApp start() to return Greenlet thread
starts OFP like other applications. Kill the original way to start OFP (start_service). Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> Reviewed-by: YAMAMOTO Takashi <yamamoto@valinux.co.jp>
This commit is contained in:
parent
8ace63f0c9
commit
5dfb0ffb45
@ -72,12 +72,6 @@ def main():
|
|||||||
services = []
|
services = []
|
||||||
services.extend(app_mgr.instantiate_apps(**contexts))
|
services.extend(app_mgr.instantiate_apps(**contexts))
|
||||||
|
|
||||||
# TODO: do the following in app_manager's instantiate_apps()
|
|
||||||
ofpapp = controller.start_service(app_mgr)
|
|
||||||
if ofpapp:
|
|
||||||
thr = hub.spawn(ofpapp)
|
|
||||||
services.append(thr)
|
|
||||||
|
|
||||||
webapp = wsgi.start_service(app_mgr)
|
webapp = wsgi.start_service(app_mgr)
|
||||||
if webapp:
|
if webapp:
|
||||||
thr = hub.spawn(webapp)
|
thr = hub.spawn(webapp)
|
||||||
|
@ -322,9 +322,3 @@ def datapath_connection_factory(socket, address):
|
|||||||
dpid_str = dpid_to_str(datapath.id)
|
dpid_str = dpid_to_str(datapath.id)
|
||||||
LOG.error("Error in the datapath %s from %s", dpid_str, address)
|
LOG.error("Error in the datapath %s from %s", dpid_str, address)
|
||||||
raise
|
raise
|
||||||
|
|
||||||
|
|
||||||
def start_service(app_mgr):
|
|
||||||
for app in app_mgr.applications.values():
|
|
||||||
if app.__class__.__name__.endswith('OFPHandler'):
|
|
||||||
return OpenFlowController()
|
|
||||||
|
@ -19,8 +19,10 @@ import logging
|
|||||||
|
|
||||||
import ryu.base.app_manager
|
import ryu.base.app_manager
|
||||||
|
|
||||||
|
from ryu.lib import hub
|
||||||
from ryu import utils
|
from ryu import utils
|
||||||
from ryu.controller import ofp_event
|
from ryu.controller import ofp_event
|
||||||
|
from ryu.controller.controller import OpenFlowController
|
||||||
from ryu.controller.handler import set_ev_handler
|
from ryu.controller.handler import set_ev_handler
|
||||||
from ryu.controller.handler import HANDSHAKE_DISPATCHER, CONFIG_DISPATCHER,\
|
from ryu.controller.handler import HANDSHAKE_DISPATCHER, CONFIG_DISPATCHER,\
|
||||||
MAIN_DISPATCHER
|
MAIN_DISPATCHER
|
||||||
@ -45,6 +47,10 @@ class OFPHandler(ryu.base.app_manager.RyuApp):
|
|||||||
super(OFPHandler, self).__init__(*args, **kwargs)
|
super(OFPHandler, self).__init__(*args, **kwargs)
|
||||||
self.name = 'ofp_event'
|
self.name = 'ofp_event'
|
||||||
|
|
||||||
|
def start(self):
|
||||||
|
super(OFPHandler, self).start()
|
||||||
|
return hub.spawn(OpenFlowController())
|
||||||
|
|
||||||
def _hello_failed(self, datapath, error_desc):
|
def _hello_failed(self, datapath, error_desc):
|
||||||
self.logger.error(error_desc)
|
self.logger.error(error_desc)
|
||||||
error_msg = datapath.ofproto_parser.OFPErrorMsg(datapath)
|
error_msg = datapath.ofproto_parser.OFPErrorMsg(datapath)
|
||||||
|
Loading…
Reference in New Issue
Block a user