Пример #1
0
    def __init__(self, chassis_name, nb_api):
        chassis_name = cfg.CONF.host

        self.db_store = db_store.get_instance()
        self.chassis_name = chassis_name
        self.nb_api = nb_api
        self.ip = cfg.CONF.df.local_ip

        app_mgr = app_manager.AppManager.get_instance()
        self.open_flow_app = app_mgr.instantiate(
            ryu_base_app.RyuDFAdapter,
            nb_api=self.nb_api,
            vswitch_api=None,
            neutron_server_notifier=None,
        )
        # The OfctlService is needed to support the 'get_flows' method
        self.open_flow_service = app_mgr.instantiate(of_service.OfctlService)
        self.ryu_switches = app_mgr.instantiate(switches.Switches)
        self.simples_switch = app_mgr.instantiate(concept_app.SimpleSwitch13)
        self.enable_selective_topo_dist = \
            cfg.CONF.df.enable_selective_topology_distribution
        self._sync = sync.Sync(
            nb_api=self.nb_api,
            update_cb=self.update,
            delete_cb=self.delete,
            selective=self.enable_selective_topo_dist,
        )
        self._sync_pulse = loopingcall.FixedIntervalLoopingCall(
            self._submit_sync_event)

        self.sync_rate_limiter = df_utils.RateLimiter(
            max_rate=1, time_unit=db_common.DB_SYNC_MINIMUM_INTERVAL)
Пример #2
0
    def __init__(self, chassis_name, nb_api):
        chassis_name = cfg.CONF.host

        self.db_store = db_store.get_instance()
        self.chassis_name = chassis_name
        self.nb_api = nb_api
        self.ip = cfg.CONF.df.local_ip
        self._sync = sync.Sync(
            nb_api=self.nb_api,
            update_cb=self.update,
            delete_cb=self.delete,
            selective=False,
        )
Пример #3
0
    def __init__(self, chassis_name, nb_api):
        #用于缓存obj
        self.db_store = db_store.get_instance()
        self._queue = queue.PriorityQueue()
        # pending_id -> (model, pender_id)
        #       'pending_id' is the ID of the object for which we are waiting.
        #       'model' and 'pender_id' are the model and the ID of the object
        #       which is waiting for the object described by 'pending_id'
        self._pending_objects = collections.defaultdict(set)

        self.chassis_name = chassis_name
        #北向api
        self.nb_api = nb_api
        #指定database change event的处理函数
        self.nb_api.set_db_change_callback(self.db_change_callback)
        #指明本主机ip地址
        self.ip = cfg.CONF.df.local_ip
        # Virtual tunnel port support multiple tunnel types together
        self.tunnel_types = cfg.CONF.df.tunnel_types
        self.neutron_notifier = None
        if cfg.CONF.df.enable_neutron_notifier:
            self.neutron_notifier = df_utils.load_driver(
                cfg.CONF.df.neutron_notifier,
                df_utils.DF_NEUTRON_NOTIFIER_DRIVER_NAMESPACE)
        #加载switch_backend
        self.switch_backend = df_utils.load_driver(
            cfg.CONF.df.switch_backend,
            df_utils.DF_SWITCH_BACKEND_DRIVER_NAMESPACE, nb_api,
            cfg.CONF.df.management_ip)

        #switch_backend初始化
        self.switch_backend.initialize(self.db_change_callback,
                                       self.neutron_notifier)
        self.topology = None
        self.enable_selective_topo_dist = \
            cfg.CONF.df.enable_selective_topology_distribution
        self._sync = sync.Sync(
            nb_api=self.nb_api,
            #指明同步对应的update,delete回调
            update_cb=self.update,
            delete_cb=self.delete,
            selective=self.enable_selective_topo_dist,
        )
        #周期性产生controller_sync事件
        self._sync_pulse = loopingcall.FixedIntervalLoopingCall(
            self._submit_sync_event)

        self.sync_rate_limiter = df_utils.RateLimiter(
            max_rate=1, time_unit=db_common.DB_SYNC_MINIMUM_INTERVAL)
Пример #4
0
    def __init__(self, nb_api):
        super(BGPService, self).__init__()
        self.initialize_driver()
        self.db_store = db_store.get_instance()

        self.nb_api = nb_api

        self.sync = sync.Sync(
            nb_api=self.nb_api,
            update_cb=self.update_model_object,
            delete_cb=self.delete_model_object,
            selective=False,
        )
        self.bgp_pulse = loopingcall.FixedIntervalLoopingCall(
            self.sync_data_from_nb_db)
Пример #5
0
    def __init__(self, chassis_name, nb_api):
        self.db_store = db_store.get_instance()
        self._queue = queue.PriorityQueue()
        # pending_id -> (model, pender_id)
        #       'pending_id' is the ID of the object for which we are waiting.
        #       'model' and 'pender_id' are the model and the ID of the object
        #       which is waiting for the object described by 'pending_id'
        self._pending_objects = collections.defaultdict(set)

        self.chassis_name = chassis_name
        self.nb_api = nb_api
        self.nb_api.set_db_change_callback(self.db_change_callback)
        self.ip = cfg.CONF.df.local_ip
        # Virtual tunnel port support multiple tunnel types together
        self.tunnel_types = cfg.CONF.df.tunnel_types
        self.sync_finished = False
        self.vswitch_api = vswitch_impl.OvsApi(cfg.CONF.df.management_ip)
        self.neutron_notifier = None
        if cfg.CONF.df.enable_neutron_notifier:
            self.neutron_notifier = df_utils.load_driver(
                     cfg.CONF.df.neutron_notifier,
                     df_utils.DF_NEUTRON_NOTIFIER_DRIVER_NAMESPACE)

        app_mgr = app_manager.AppManager.get_instance()
        self.open_flow_app = app_mgr.instantiate(
            ryu_base_app.RyuDFAdapter,
            nb_api=self.nb_api,
            vswitch_api=self.vswitch_api,
            neutron_server_notifier=self.neutron_notifier,
            db_change_callback=self.db_change_callback
        )
        # The OfctlService is needed to support the 'get_flows' method
        self.open_flow_service = app_mgr.instantiate(of_service.OfctlService)
        self.topology = None
        self.enable_selective_topo_dist = \
            cfg.CONF.df.enable_selective_topology_distribution
        self._sync = sync.Sync(
            nb_api=self.nb_api,
            update_cb=self.update,
            delete_cb=self.delete,
            selective=self.enable_selective_topo_dist,
        )
        self._sync_pulse = loopingcall.FixedIntervalLoopingCall(
            self._submit_sync_event)

        self.sync_rate_limiter = df_utils.RateLimiter(
                max_rate=1, time_unit=db_common.DB_SYNC_MINIMUM_INTERVAL)
Пример #6
0
    def setUp(self):
        super(TestSync, self).setUp()
        self._db_store = db_store.get_instance()
        self._db_store.clear()

        self.nb_api = api_nb.NbApi(db_driver=mock.Mock())
        self.nb_api.publisher = mock.Mock()
        self.nb_api.enable_selective_topo_dist = True
        self._update = mock.Mock(side_effect=self._db_store.update)
        self._delete = mock.Mock(side_effect=self._db_store.delete)
        self.sync = sync.Sync(
            self.nb_api,
            self._update,
            self._delete,
        )
        self.sync.add_model(TopiclessModel)
        self.sync.add_model(TopicModel1)
        self.sync.add_model(TopicModel2)
Пример #7
0
    def __init__(self, chassis_name, nb_api):
        self.db_store = db_store.get_instance()

        self.chassis_name = chassis_name
        self.nb_api = nb_api
        self.ip = cfg.CONF.df.local_ip
        # Virtual tunnel port support multiple tunnel types together
        self.tunnel_types = cfg.CONF.df.tunnel_types
        self.sync_finished = False
        self.vswitch_api = vswitch_impl.OvsApi(cfg.CONF.df.management_ip)
        self.neutron_notifier = None
        if cfg.CONF.df.enable_neutron_notifier:
            self.neutron_notifier = df_utils.load_driver(
                cfg.CONF.df.neutron_notifier,
                df_utils.DF_NEUTRON_NOTIFIER_DRIVER_NAMESPACE)

        app_mgr = app_manager.AppManager.get_instance()
        self.open_flow_app = app_mgr.instantiate(
            ryu_base_app.RyuDFAdapter,
            nb_api=self.nb_api,
            vswitch_api=self.vswitch_api,
            neutron_server_notifier=self.neutron_notifier,
        )
        # The OfctlService is needed to support the 'get_flows' method
        self.open_flow_service = app_mgr.instantiate(of_service.OfctlService)
        self.topology = None
        self.enable_selective_topo_dist = \
            cfg.CONF.df.enable_selective_topology_distribution
        self._sync = sync.Sync(
            nb_api=self.nb_api,
            update_cb=self.update,
            delete_cb=self.delete,
            selective=self.enable_selective_topo_dist,
        )
        self._sync_pulse = loopingcall.FixedIntervalLoopingCall(
            self._submit_sync_event)

        self.sync_rate_limiter = df_utils.RateLimiter(
            max_rate=1, time_unit=db_common.DB_SYNC_MINIMUM_INTERVAL)