本文整理汇总了Python中ryu.base.app_manager.AppManager.close方法的典型用法代码示例。如果您正苦于以下问题:Python AppManager.close方法的具体用法?Python AppManager.close怎么用?Python AppManager.close使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ryu.base.app_manager.AppManager
的用法示例。
在下文中一共展示了AppManager.close方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: main
# 需要导入模块: from ryu.base.app_manager import AppManager [as 别名]
# 或者: from ryu.base.app_manager.AppManager import close [as 别名]
def main():
try:
CONF(project='ryu', version='ryu-manager %s' % version,
default_config_files=['/usr/local/etc/ryu/ryu.conf'])
except cfg.ConfigFilesNotFoundError:
CONF(project='ryu', version='ryu-manager %s' % version)
log.init_log()
app_lists = CONF.app_lists + CONF.app
app_mgr = AppManager()
app_mgr.load_apps(app_lists)
contexts = app_mgr.create_contexts()
app_mgr.instantiate_apps(**contexts)
services = []
# 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)
services.append(thr)
try:
hub.joinall(services)
finally:
app_mgr.close()
示例2: main
# 需要导入模块: from ryu.base.app_manager import AppManager [as 别名]
# 或者: from ryu.base.app_manager.AppManager import close [as 别名]
def main():
try:
CONF(project='ryu', version='ryu-manager %s' % version,
default_config_files=['/usr/local/etc/ryu/ryu.conf'])
except cfg.ConfigFilesNotFoundError:
CONF(project='ryu', version='ryu-manager %s' % version)
log.init_log()
# 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()