Later RyuApp instances will be created/deleted dynamically. For that sake, the single instance of AppManager is necessary.
Signed-off-by: Isaku Yamahata <[email protected]> --- bin/ryu-manager | 2 +- ryu/base/app_manager.py | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/bin/ryu-manager b/bin/ryu-manager index d9cc805..eb83ae4 100755 --- a/bin/ryu-manager +++ b/bin/ryu-manager @@ -61,7 +61,7 @@ def main(): # always enable ofp for now. app_lists = CONF.app_lists + CONF.app + ['ryu.controller.ofp_handler'] - app_mgr = AppManager() + app_mgr = AppManager.get_instance() app_mgr.load_apps(app_lists) contexts = app_mgr.create_contexts() app_mgr.instantiate_apps(**contexts) diff --git a/ryu/base/app_manager.py b/ryu/base/app_manager.py index 0112aab..aece004 100644 --- a/ryu/base/app_manager.py +++ b/ryu/base/app_manager.py @@ -144,6 +144,15 @@ class RyuApp(object): class AppManager(object): + # singletone + _instance = None + + @staticmethod + def get_instance(): + if not AppManager._instance: + AppManager._instance = AppManager() + return AppManager._instance + def __init__(self): self.applications_cls = {} self.applications = {} -- 1.7.10.4 ------------------------------------------------------------------------------ Minimize network downtime and maximize team effectiveness. Reduce network management and security costs.Learn how to hire the most talented Cisco Certified professionals. Visit the Employer Resources Portal http://www.cisco.com/web/learning/employer_resources/index.html _______________________________________________ Ryu-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/ryu-devel
