コード例 #1
0
    def setUp(self):
        super(TestOsKenBaseApp, self).setUp()
        os_ken_cfg.CONF(project='os_ken', args=[])
        os_ken_cfg.CONF.ofp_listen_host = cfg.CONF.df_os_ken.of_listen_address
        os_ken_cfg.CONF.ofp_tcp_listen_port = (
            cfg.CONF.df_os_ken.of_listen_port + 1)
        app_mgr = app_manager.AppManager.get_instance()
        self.open_flow_app = app_mgr.instantiate(
            os_ken_base_app.OsKenDFAdapter,
            switch_backend=mock.Mock(),
            nb_api=mock.Mock(),
            db_change_callback=self._db_change_callback)
        self.open_flow_app.load = mock.Mock()
        self.addCleanup(app_mgr.uninstantiate, self.open_flow_app.name)

        test_controller = ('tcp:' + cfg.CONF.df_os_ken.of_listen_address +
                           ':' + str(cfg.CONF.df_os_ken.of_listen_port + 1))
        self.vswitch_api = vswitch_impl.OvsApi(self.mgt_ip)
        self.vswitch_api.initialize(self._db_change_callback)
        cur_controllers = self.vswitch_api.ovsdb.get_controller(
            self.integration_bridge).execute()
        cur_controllers.append(test_controller)
        self.vswitch_api.set_controller(self.integration_bridge,
                                        cur_controllers)

        cur_controllers.pop()
        self.addCleanup(self.vswitch_api.set_controller,
                        self.integration_bridge, cur_controllers)

        self.open_flow_app.start()
        time.sleep(const.DEFAULT_CMD_TIMEOUT)
コード例 #2
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,
        )
        self.topology = None
        self.db_consistency_manager = None
        self.enable_db_consistency = cfg.CONF.df.enable_df_db_consistency
        self.enable_selective_topo_dist = \
            cfg.CONF.df.enable_selective_topology_distribution
コード例 #3
0
    def setUp(self):
        super(TestRyuBaseApp, self).setUp()
        ryu_cfg.CONF(project='ryu', args=[])
        ryu_cfg.CONF.ofp_listen_host = cfg.CONF.df_ryu.of_listen_address
        ryu_cfg.CONF.ofp_tcp_listen_port = cfg.CONF.df_ryu.of_listen_port + 1
        app_mgr = app_manager.AppManager.get_instance()
        self.open_flow_app = app_mgr.instantiate(ryu_base_app.RyuDFAdapter)
        self.open_flow_app.load = mock.Mock()
        self.addCleanup(app_mgr.uninstantiate, self.open_flow_app.name)

        test_controller = ('tcp:' + cfg.CONF.df_ryu.of_listen_address + ':' +
                           str(cfg.CONF.df_ryu.of_listen_port + 1))
        self.vswitch_api = vswitch_impl.OvsApi(self.mgt_ip)
        self.vswitch_api.initialize(self.nb_api)
        cur_controllers = self.vswitch_api.ovsdb.get_controller(
            self.integration_bridge).execute()
        cur_controllers.append(test_controller)
        self.vswitch_api.set_controller(self.integration_bridge,
                                        cur_controllers)

        cur_controllers.pop()
        self.addCleanup(self.vswitch_api.set_controller,
                        self.integration_bridge, cur_controllers)

        self.open_flow_app.start()
        time.sleep(const.DEFAULT_CMD_TIMEOUT)
コード例 #4
0
 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
     self.port_status_notifier = None
     nb_driver = df_utils.load_driver(cfg.CONF.df.nb_db_class,
                                      df_utils.DF_NB_DB_DRIVER_NAMESPACE)
     self.nb_api = api_nb.NbApi(nb_driver,
                                use_pubsub=cfg.CONF.df.enable_df_pub_sub)
     self.vswitch_api = vswitch_impl.OvsApi(self.ip)
     if cfg.CONF.df.enable_port_status_notifier:
         self.port_status_notifier = df_utils.load_driver(
             cfg.CONF.df.port_status_notifier,
             df_utils.DF_PORT_STATUS_DRIVER_NAMESPACE)
     kwargs = dict(nb_api=self.nb_api,
                   vswitch_api=self.vswitch_api,
                   db_store=self.db_store)
     app_mgr = app_manager.AppManager.get_instance()
     self.open_flow_app = app_mgr.instantiate(ryu_base_app.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
コード例 #5
0
 def __init__(self, nb_api, ip):
     super(DfOvsDriver, self).__init__(nb_api)
     init_ryu_config()
     self.vswitch_api = vswitch_impl.OvsApi(ip)
     self.app_mgr = app_manager.AppManager.get_instance()
     self.open_flow_app = None
     self.open_flow_service = None
     self.neutron_notifier = None
コード例 #6
0
ファイル: df_ovs_driver.py プロジェクト: huongbn/dragonflow
 def __init__(self, nb_api, ip):
     super(DfOvsDriver, self).__init__(nb_api)
     init_os_ken_config()
     self.vswitch_api = vswitch_impl.OvsApi(ip)
     self.app_mgr = app_manager.AppManager.get_instance()
     self.open_flow_app = None
     self.open_flow_service = None
     self.neutron_notifier = None
     self._datapath = datapath.Datapath(
         datapath_layout.get_datapath_layout())
コード例 #7
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)
コード例 #8
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)
コード例 #9
0
 def setUp(self):
     super(TestOvsdbMonitor, self).setUp()
     self.set_wanted_vms = set()
     self.vswitch_api = vswitch_impl.OvsApi(self.local_ip)
     self.vswitch_api.initialize(self.nb_api)