starts OFP like other applications. Kill the original way to start OFP
(start_service).

Signed-off-by: FUJITA Tomonori <[email protected]>
---
 ryu/cmd/manager.py            | 6 ------
 ryu/controller/controller.py  | 6 ------
 ryu/controller/ofp_handler.py | 6 ++++++
 3 files changed, 6 insertions(+), 12 deletions(-)

diff --git a/ryu/cmd/manager.py b/ryu/cmd/manager.py
index 474dcec..234b96c 100755
--- a/ryu/cmd/manager.py
+++ b/ryu/cmd/manager.py
@@ -72,12 +72,6 @@ def main():
     services = []
     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)
     if webapp:
         thr = hub.spawn(webapp)
diff --git a/ryu/controller/controller.py b/ryu/controller/controller.py
index 5d71d3c..f9b592f 100644
--- a/ryu/controller/controller.py
+++ b/ryu/controller/controller.py
@@ -322,9 +322,3 @@ def datapath_connection_factory(socket, address):
                 dpid_str = dpid_to_str(datapath.id)
             LOG.error("Error in the datapath %s from %s", dpid_str, address)
             raise
-
-
-def start_service(app_mgr):
-    for app in app_mgr.applications.values():
-        if app.__class__.__name__.endswith('OFPHandler'):
-            return OpenFlowController()
diff --git a/ryu/controller/ofp_handler.py b/ryu/controller/ofp_handler.py
index 642cec8..b95ff0c 100644
--- a/ryu/controller/ofp_handler.py
+++ b/ryu/controller/ofp_handler.py
@@ -19,8 +19,10 @@ import logging
 
 import ryu.base.app_manager
 
+from ryu.lib import hub
 from ryu import utils
 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 HANDSHAKE_DISPATCHER, CONFIG_DISPATCHER,\
     MAIN_DISPATCHER
@@ -45,6 +47,10 @@ class OFPHandler(ryu.base.app_manager.RyuApp):
         super(OFPHandler, self).__init__(*args, **kwargs)
         self.name = 'ofp_event'
 
+    def start(self):
+        super(OFPHandler, self).start()
+        return hub.spawn(OpenFlowController())
+
     def _hello_failed(self, datapath, error_desc):
         self.logger.error(error_desc)
         error_msg = datapath.ofproto_parser.OFPErrorMsg(datapath)
-- 
1.8.3.4 (Apple Git-47)


------------------------------------------------------------------------------
Shape the Mobile Experience: Free Subscription
Software experts and developers: Be at the forefront of tech innovation.
Intel(R) Software Adrenaline delivers strategic insight and game-changing 
conversations that shape the rapidly evolving mobile landscape. Sign up now. 
http://pubads.g.doubleclick.net/gampad/clk?id=63431311&iu=/4140/ostg.clktrk
_______________________________________________
Ryu-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ryu-devel

Reply via email to