def register_app(app): assert isinstance(app, RyuApp) # print "SERVICE_BRICKS:", SERVICE_BRICKS assert app.name not in SERVICE_BRICKS SERVICE_BRICKS[app.name] = app register_instance(app)
def instantiate_apps(self, *args, **kwargs): for app_name, cls in self.applications_cls.items(): # for now, only single instance of a given module # Do we need to support multiple instances? # Yes, maybe for slicing. LOG.info('instantiating app %s', app_name) assert app_name not in self.applications app = cls(*args, **kwargs) register_instance(app) self.applications[app_name] = app
def __init__(self, *args, **kwargs): super(Tester, self).__init__() self.ev_q = dispatcher.EventQueue(QUEUE_NAME_RUN_TEST_EV, RUN_TEST_EV_DISPATCHER) run_test_mod = utils.import_module(FLAGS.run_test_mod) LOG.debug('import run_test_mod.[%s]', run_test_mod.__name__) self.run_test = run_test_mod.RunTest(*args, **kwargs) handler.register_instance(self.run_test)
def __init__(self): super(DPSet, self).__init__() # dp registration and type setting can be occur in any order # Sometimes the sw_type is set before dp connection self.dp_types = {} self.dps = {} # datapath_id => class Datapath self.ev_q = dispatcher.EventQueue(QUEUE_NAME_DPSET, DPSET_EV_DISPATCHER) handler.register_instance(self)
def load(self, app_mod_name, *args, **kwargs): # for now, only single instance of a given module # Do we need to support multiple instances? # Yes, maybe for slicing. assert app_mod_name not in self.applications cls = utils.import_object(app_mod_name) app = cls(*args, **kwargs) register_instance(app) self.applications[app_mod_name] = app
def register_app(app): # print('app:',app) #('app:', <ryu.controller.ofp_handler.OFPHandler object at 0x7f457f769410>) assert isinstance(app, RyuApp) # print('isinstance(app,RyuApp):',isinstance(app,RyuApp)) #('isinstance(app,RyuApp):', True) # print('app.name:',app.name) #('app.name:', 'ofp_event') # print('server_bricks:',SERVICE_BRICKS) #('server_bricks:', {}) # assert app.name not in SERVICE_BRICKS # print('SERVICE_BRICKS:',SERVICE_BRICKS) SERVICE_BRICKS[app.name] = app # print('SERVICE_BRICKS:', SERVICE_BRICKS) #('SERVICE_BRICKS:', {'ofp_event': <ryu.controller.ofp_handler.OFPHandler object at 0x7f457f769410>}) register_instance(app)
def instantiate_apps(self, *args, **kwargs): for app_name, cls in self.applications_cls.items(): # for now, only single instance of a given module # Do we need to support multiple instances? # Yes, maybe for slicing. LOG.info('instantiating app %s', app_name) if 'OFP_VERSIONS' in cls.__dict__: for k in Datapath.supported_ofp_version.keys(): if not k in cls.OFP_VERSIONS: del Datapath.supported_ofp_version[k] assert len(Datapath.supported_ofp_version), \ 'No OpenFlow version is available' assert app_name not in self.applications app = cls(*args, **kwargs) register_instance(app) self.applications[app_name] = app
def register_app(app): assert isinstance(app, RyuApp) assert not app.name in SERVICE_BRICKS SERVICE_BRICKS[app.name] = app register_instance(app)
def register_app(app): assert isinstance(app, RyuApp) assert app.name not in SERVICE_BRICKS SERVICE_BRICKS[app.name] = app # 调用handler中的函数 register_instance(app)
def register_app(app): assert isinstance(app, RyuApp) assert app.name not in SERVICE_BRICKS LOG.info("app.name: %s", app.name) SERVICE_BRICKS[app.name] = app register_instance(app)