def setUp(self): super(DFTestBase, self).setUp() if os.environ.get('DF_FULLSTACK_USE_ENV'): try: self.neutron = clients.get_neutron_client_from_env() except KeyError as e: message = ('Cannot find environment variable %s. ' 'Have you sourced openrc?') LOG.error(message, e.args[0]) self.fail(message % e.args[0]) else: self.neutron = clients.get_neutron_client_from_cloud_config() self.neutron.format = 'json' # NOTE: Each env can only have one default subnetpool for each # IP version. if not self.get_default_subnetpool(): self.create_default_subnetpool() df_utils.config_parse() self.conf = cfg.CONF.df self.integration_bridge = self.conf.integration_bridge self.nb_api = api_nb.NbApi.get_instance(False) self.mgt_ip = self.conf.management_ip self.__objects_to_close = [] self.addCleanup(self._close_stored_objects) self.vswitch_api = utils.OvsTestApi(self.mgt_ip) self.vswitch_api.initialize(self.nb_api) if cfg.CONF.df.enable_selective_topology_distribution: self.start_subscribing()
def setUp(self): super(DFTestBase, self).setUp() if os.environ.get('DF_FULLSTACK_USE_ENV'): try: self.neutron = clients.get_neutron_client_from_env() except KeyError as e: message = ('Cannot find environment variable %s. ' 'Have you sourced openrc?') LOG.error(message, e.args[0]) self.fail(message % e.args[0]) else: self.neutron = clients.get_neutron_client_from_cloud_config() self.neutron.format = 'json' # NOTE: Each env can only have one default subnetpool for each # IP version. if not self.get_default_subnetpool(): self.create_default_subnetpool() df_utils.config_parse() self.conf = cfg.CONF.df self.integration_bridge = self.conf.integration_bridge self._queue = queue.PriorityQueue() self.nb_api = api_nb.NbApi.get_instance() # As we are running in the same process over and over, # do not perform redundant calls to the subscriber if not self.nb_api.subscriber.is_running: self.nb_api.set_db_change_callback(self._db_change_callback) self.mgt_ip = self.conf.management_ip self.__objects_to_close = [] self.addCleanup(self._close_stored_objects) self.vswitch_api = utils.OvsTestApi(self.mgt_ip) self.vswitch_api.initialize(self._db_change_callback) if cfg.CONF.df.enable_selective_topology_distribution: self.start_subscribing() if cfg.CONF.df.enable_df_pub_sub: self._publish_log_event('started') self.addCleanup(self._publish_log_event, 'finished') self.dfdp = datapath.load_datapath()