summaryrefslogtreecommitdiffhomepage
path: root/bin
diff options
context:
space:
mode:
authorIsaku Yamahata <yamahata@valinux.co.jp>2012-05-29 18:26:57 +0900
committerFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>2012-05-30 11:58:15 +0900
commit32f644fbe91a1399534cde28182ee81018e4fd03 (patch)
tree615a28b82464eae6c33b55592ec5adfac9bd2201 /bin
parent1e540507bd509cfda0f4ff14a984ac669ca5f7a7 (diff)
base/app_manager: introduce application context
The ryu-manager creates structures which applications share. Currently it is hard-coded in ryu-managers. Concretely network.Network and dpset.DPSet. It is difficult to maintain the code appropriately by hand. When the application is changed or new application comes in, ryu-manager also must be updated. So introduce the notion of application context so that application manager can determine what structures applications want to share and create them. Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp> Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Diffstat (limited to 'bin')
-rwxr-xr-xbin/ryu-manager15
1 files changed, 12 insertions, 3 deletions
diff --git a/bin/ryu-manager b/bin/ryu-manager
index cb57e623..a6944e2e 100755
--- a/bin/ryu-manager
+++ b/bin/ryu-manager
@@ -49,11 +49,18 @@ def main():
_args = FLAGS(sys.argv)
log.init_log()
- nw = network.Network()
- dpset_ = dpset.DPSet()
+ # to make non-converted apps work. Once all of them converted,
+ # this will be removed.
+ kwargs = {
+ 'network': network.Network(),
+ 'dpset': dpset.DPSet(),
+ }
app_mgr = AppManager()
- app_mgr.load_apps(FLAGS.app_lists, network=nw, dpset=dpset_)
+ app_mgr.load_apps(FLAGS.app_lists)
+ contexts = app_mgr.create_contexts()
+ contexts.update(kwargs)
+ app_mgr.instantiate_apps(**contexts)
services = []
@@ -67,6 +74,8 @@ def main():
services.append(thr)
gevent.joinall(services)
+ app_mgr.close()
+
if __name__ == "__main__":
main()