当前位置: 首页>>代码示例>>Python>>正文


Python app_manager.AppManager类代码示例

本文整理汇总了Python中ryu.base.app_manager.AppManager的典型用法代码示例。如果您正苦于以下问题:Python AppManager类的具体用法?Python AppManager怎么用?Python AppManager使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了AppManager类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: main

def main():
    common_config.init(sys.argv[1:])
    # the following check is a transitional workaround to make this work
    # with different versions of ryu.
    # TODO(yamamoto) remove this later
    if ryu_cfg.CONF is not cfg.CONF:
        ryu_cfg.CONF(project="ryu", args=[])
    common_config.setup_logging()
    AppManager.run_apps(["neutron.plugins.ofagent.agent.ofa_neutron_agent"])
开发者ID:noironetworks,项目名称:neutron2,代码行数:9,代码来源:main.py

示例2: main

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()
开发者ID:09beeihaq,项目名称:Coursera-SDN-Assignments,代码行数:33,代码来源:manager.py

示例3: main

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()
开发者ID:MichalPalatinus,项目名称:ryu,代码行数:32,代码来源:manager.py

示例4: main

def main():
    try:
        CONF(project='ryu', version='ofa_neutron_agent %s' % version,
             default_config_files=['/usr/local/etc/ryu/ryu.conf'])
    except cfg.ConfigFilesNotFoundError:
        CONF(project='ryu', version='ofa_neutron_agent %s' % version)

    osn_config.setup_logging(CONF)

    app_lists = CONF.app_lists + CONF.app
    if not app_lists:
        app_lists = ['neutron.plugins.ofagent.agent.ofa_neutron_agent']

    app_mgr = AppManager.get_instance()
    app_mgr.load_apps(app_lists)
    contexts = app_mgr.create_contexts()
    services = []
    services.extend(app_mgr.instantiate_apps(**contexts))

    webapp = wsgi.start_service(app_mgr)
    if webapp:
        thr = hub.spawn(webapp)
        services.append(thr)

    try:
        hub.joinall(services)
    finally:
        app_mgr.close()
开发者ID:Annjana,项目名称:ryu,代码行数:28,代码来源:ofa_neutron_agent.py

示例5: __init__

    def __init__(self, chassis_name):
        self.next_network_id = 0
        self.db_store = db_store.DbStore()
        self.chassis_name = chassis_name
        self.ip = cfg.CONF.df.local_ip
        self.tunnel_type = cfg.CONF.df.tunnel_type
        self.sync_finished = False
        nb_driver_class = importutils.import_class(cfg.CONF.df.nb_db_class)
        self.nb_api = api_nb.NbApi(
            nb_driver_class(),
            use_pubsub=cfg.CONF.df.enable_df_pub_sub)
        self.vswitch_api = ovsdb_vswitch_impl.OvsdbSwitchApi(
            self.ip, self.nb_api)
        kwargs = dict(
            nb_api=self.nb_api,
            vswitch_api=self.vswitch_api,
            db_store=self.db_store
        )
        app_mgr = AppManager.get_instance()
        self.open_flow_app = app_mgr.instantiate(RyuDFAdapter, **kwargs)

        self.topology = None
        self.enable_selective_topo_dist = \
            cfg.CONF.df.enable_selective_topology_distribution
        self.integration_bridge = cfg.CONF.df.integration_bridge
开发者ID:HarborOS,项目名称:dragonflow,代码行数:25,代码来源:df_local_controller.py

示例6: main

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
    # keep old behaivor, run ofp if no application is specified.
    if not app_lists:
        app_lists = ['ryu.controller.ofp_handler']

    app_mgr = AppManager.get_instance()
    app_mgr.load_apps(app_lists)
    contexts = app_mgr.create_contexts()
    services = []
    services.extend(app_mgr.instantiate_apps(**contexts))

    webapp = wsgi.start_service(app_mgr)
    if webapp:
        thr = hub.spawn(webapp)
        services.append(thr)

    try:
        hub.joinall(services)
    finally:
        app_mgr.close()
开发者ID:Qazzzz,项目名称:ryu,代码行数:29,代码来源:manager.py

示例7: initialize

 def initialize(self):
     app_mgr = AppManager.get_instance()
     LOG.debug(("RYU openflow stack, DragonFlow OpenFlow Controller"))
     l3app_kwargs = dict(
         idle_timeout=self.cfg.CONF.subnet_flows_idle_timeout,
         hard_timeout=self.cfg.CONF.subnet_flows_hard_timeout
     )
     self.open_flow_hand = app_mgr.instantiate(OFPHandler, None, None)
     self.l3_app = app_mgr.instantiate(L3ReactiveApp, None, **l3app_kwargs)
开发者ID:CingHu,项目名称:dragonflow,代码行数:9,代码来源:openflow_controller.py

示例8: __init__

	def __init__(self, *args, **kwargs):
		super(Loader, self).__init__(*args, **kwargs)

		self.feature_events = []
		self.table_id = 0

		self.ryu_mgr = AppManager.get_instance()
		self.install(OFPHandler)
		self.install(SwitchListen(lambda ev: self.switch_features_handler(ev)))
		self.start_listening()
开发者ID:amasend,项目名称:l_pierwsze,代码行数:10,代码来源:loader.py

示例9: __init__

    def __init__(self, *args, **kwargs):
        super(DynamicLoader, self).__init__(*args, **kwargs)
        self.ryu_mgr = AppManager.get_instance()
        self.available_app = []
        self.init_apps()
        wsgi = self.create_wsgi_app('0.0.0.0', 5566)
        self.mapper = wsgi.mapper
        wsgi.registory['DLController'] = self

        self.init_mapper()
开发者ID:harimau99,项目名称:Dragon-Knight,代码行数:10,代码来源:dk_plugin.py

示例10: run

    def run(self):
        self.nb_api = ovsdb_nb_impl.OvsdbNbApi(self.remote_db_ip)
        #self.nb_api = etcd_nb_impl.EtcdNbApi()
        self.nb_api.initialize()
        self.vswitch_api = ovsdb_vswitch_impl.OvsdbSwitchApi(self.ip)
        self.vswitch_api.initialize()

        app_mgr = AppManager.get_instance()
        self.open_flow_app = app_mgr.instantiate(OFPHandler, None, None)
        self.open_flow_app.start()
        self.l2_app = app_mgr.instantiate(L2App, None, None)
        self.l2_app.start()
        self.db_sync_loop()
开发者ID:sheepcat,项目名称:dragonflow,代码行数:13,代码来源:df_local_controller.py

示例11: main

def main():
    args = sys.argv[1:]
    try:
        CONF(args=args, prog=sys.argv[0],
             project='daolicontroller', version='1.1',
             default_config_files=['/etc/daolicontroller/daolicontroller.conf'])
    except cfg.ConfigFilesNotFoundError:
        CONF(args=args, prog=sys.argv[0],
             project='daolicontroller', version='1.1')

    log.init_log()

    #if ryu_cfg.CONF is not CONF:
    #    ryu_cfg.CONF(args=args, project='ryu')

    #if CONF.enable_debugger:
    #    LOG = logging.getLogger('daolicontroller')
    #    msg = 'debugging is available (--enable-debugger option is turned on)'
    #    LOG.info(msg)
    #else:
    	#hub.patch(thread=True)

    AppManager.run_apps(['daolicontroller.ofa_agent'])
开发者ID:foruy,项目名称:openflow-docker,代码行数:23,代码来源:manager.py

示例12: __init__

 def __init__(self, chassis_name):
     self.next_network_id = 0
     self.db_store = db_store.DbStore()
     self.nb_api = None
     self.vswitch_api = None
     self.chassis_name = chassis_name
     self.ip = cfg.CONF.df.local_ip
     self.tunnel_type = cfg.CONF.df.tunnel_type
     self.sync_finished = False
     kwargs = dict(
         db_store=self.db_store
     )
     app_mgr = AppManager.get_instance()
     self.open_flow_app = app_mgr.instantiate(RyuDFAdapter, **kwargs)
开发者ID:feipeng1,项目名称:dragonflow,代码行数:14,代码来源:df_local_controller.py

示例13: main

def main(args=None, prog=None):
    try:
        CONF(
            args=args,
            prog=prog,
            project="ryu",
            version="ryu-manager {}".format(version),
            default_config_files=["/usr/local/etc/ryu/ryu.conf"],
        )
    except cfg.ConfigFilesNotFoundError:
        CONF(args=args, prog=prog, project="ryu", version="ryu-manager {}".format(version))

    log.init_log()
    hub.patch(thread=True)

    if CONF.pid_file:
        LOG.info("Pid file : %s", CONF.pid_file)
        import os

        with open(CONF.pid_file, "w") as pid_file:
            pid_file.write(str(os.getpid()))

    app_lists = CONF.app_lists + CONF.app

    if not app_lists:
        app_lists = ["ryu.controller.ofp_handler", "dragon_knight.dk_plugin"]

    if "ryu.controller.ofp_handler" not in app_lists:
        app_lists.append("ryu.controller.ofp_handler")

    if "dragon_knight.dk_plugin" not in app_lists:
        app_lists.append("dragon_knight.dk_plugin")

    app_mgr = AppManager.get_instance()
    app_mgr.load_apps(app_lists)
    contexts = app_mgr.create_contexts()
    services = []
    services.extend(app_mgr.instantiate_apps(**contexts))

    webapp = wsgi.start_service(app_mgr)

    if webapp:
        thr = hub.spawn(webapp)
        services.append(thr)

    try:
        hub.joinall(services)

    finally:
        app_mgr.close()
开发者ID:Ryu-Dragon-Knight,项目名称:Dragon-Knight,代码行数:50,代码来源:daemon.py

示例14: main

def main(args=None, prog=None):
    try:
        CONF(args=args, prog=prog,
             project='ryu', version='ryu-manager %s' % version,
             default_config_files=['/usr/local/etc/ryu/ryu.conf'])
    except cfg.ConfigFilesNotFoundError:
        CONF(args=args, prog=prog,
             project='ryu', version='ryu-manager %s' % version)

    log.init_log()

    if CONF.pid_file:
        import os
        with open(CONF.pid_file, 'w') as pid_file:
            pid_file.write(str(os.getpid()))

    app_lists = CONF.app_lists + CONF.app
    # keep old behaivor, run ofp if no application is specified.
    if not app_lists:
        app_lists = ['ryu.controller.ofp_handler']

    #if CONF.oxp_role == 'super':
    #    app_lists.extend(['ryu.openexchange.super.oxp_server_handler',
    #                      'ryu.openexchange.super.topology',
    #                      'ryu.openexchange.super.routing'])

    #elif CONF.oxp_role == 'domain':
    #    app_lists.extend(
    #        ['ryu.openexchange.domain.oxp_client_handler',
    #         'ryu.openexchange.network.abstract',
    #         'ryu.openexchange.network.topo_reply',
    #         'ryu.openexchange.network.echo_loop',
    #         'ryu.openexchange.domain.translation'])

    app_mgr = AppManager.get_instance()
    app_mgr.load_apps(app_lists)
    contexts = app_mgr.create_contexts()
    services = []
    services.extend(app_mgr.instantiate_apps(**contexts))

    webapp = wsgi.start_service(app_mgr)
    if webapp:
        thr = hub.spawn(webapp)
        services.append(thr)

    try:
        hub.joinall(services)
    finally:
        app_mgr.close()
开发者ID:Jasonlyt,项目名称:ryu,代码行数:49,代码来源:manager.py

示例15: load

    def load(self):
        app_mgr = AppManager.get_instance()
        self.open_flow_app = app_mgr.instantiate(OFPHandler, None, None)
        self.open_flow_app.start()

        for app in self.apps_list:
            app_class_name = self.apps_location_prefix + "." + app
            try:
                app_class = importutils.import_class(app_class_name)
                app = app_mgr.instantiate(app_class, None, **self.params)
                app.start()
                self.apps.append(app)
            except ImportError as e:
                LOG.exception(_LE("Error loading application by class, %s"), e)
                raise ImportError(_("Application class not found."))
开发者ID:xujinrong,项目名称:dragonflow,代码行数:15,代码来源:dispatcher.py


注:本文中的ryu.base.app_manager.AppManager类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。