Signed-off-by: Isaku Yamahata <yamah...@valinux.co.jp>
---
 bin/ryu-manager |   55 +++++--------------------------------------------------
 1 file changed, 5 insertions(+), 50 deletions(-)

diff --git a/bin/ryu-manager b/bin/ryu-manager
index 62188de..7afbeec 100755
--- a/bin/ryu-manager
+++ b/bin/ryu-manager
@@ -16,70 +16,25 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-from ryu.lib import hub
-hub.patch()
-
-# TODO:
-#   Right now, we have our own patched copy of ovs python bindings
-#   Once our modification is upstreamed and widely deployed,
-#   use it
-#
-# NOTE: this modifies sys.path and thus affects the following imports.
-# eg. oslo.config.cfg.
-import ryu.contrib
+from ryu.base import main as ryu_main
+ryu_main.early_init()
 
 from oslo.config import cfg
-import logging
-import sys
-
-from ryu import log
-log.early_init_log(logging.DEBUG)
-
-from ryu import flags
-from ryu import version
-from ryu.app import wsgi
-from ryu.base.app_manager import AppManager
-from ryu.controller import controller
-from ryu.topology import switches
 
 
 CONF = cfg.CONF
 CONF.register_cli_opts([
     cfg.ListOpt('app-lists', default=[],
                 help='application module name to run'),
-    cfg.MultiStrOpt('app', positional=True, default=[],
-                    help='application module name to run')
 ])
 
 
 def main():
-    CONF(project='ryu', version='ryu-manager %s' % version)
-
-    log.init_log()
+    ryu_main.init()
 
     # always enable ofp for now.
-    app_lists = CONF.app_lists + CONF.app + ['ryu.controller.ofp_handler']
-
-    app_mgr = AppManager()
-    app_mgr.load_apps(app_lists)
-    contexts = app_mgr.create_contexts()
-    app_mgr.instantiate_apps(**contexts)
-
-    services = []
-
-    ctlr = controller.OpenFlowController()
-    thr = hub.spawn(ctlr)
-    services.append(thr)
-
-    webapp = wsgi.start_service(app_mgr)
-    if webapp:
-        thr = hub.spawn(webapp)
-        services.append(thr)
-
-    try:
-        hub.joinall(services)
-    finally:
-        app_mgr.close()
+    app_lists = CONF.app_lists + ['ryu.controller.ofp_handler']
+    ryu_main.main(app_lists, True)
 
 
 if __name__ == "__main__":
-- 
1.7.10.4


------------------------------------------------------------------------------
How ServiceNow helps IT people transform IT departments:
1. A cloud service to automate IT design, transition and operations
2. Dashboards that offer high-level views of enterprise services
3. A single system of record for all IT processes
http://p.sf.net/sfu/servicenow-d2d-j
_______________________________________________
Ryu-devel mailing list
Ryu-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ryu-devel

Reply via email to