Esempio n. 1
0
 def setUp(self):
     core.initialize()
     core.ModelBase.metadata.create_all(core.get_engine())
     # enforce foreign key constraint for sqlite
     core.get_engine().execute('pragma foreign_keys=on')
     self.context = context.Context()
     self.xmanager = FakeXManager()
 def setUp(self):
     core.initialize()
     core.ModelBase.metadata.create_all(core.get_engine())
     core.get_engine().execute('pragma foreign_keys=on')
     self.context = context.Context()
     xmanager.IN_TEST = True
     directory.get_plugin = fake_get_plugin
Esempio n. 3
0
    def setUp(self):
        core.initialize()
        core.ModelBase.metadata.create_all(core.get_engine())
        # enforce foreign key constraint for sqlite
        core.get_engine().execute('pragma foreign_keys=on')
        self.context = context.Context()

        pod_dict = {
            'pod_id': FAKE_SITE_ID,
            'region_name': FAKE_SITE_NAME,
            'az_name': FAKE_AZ
        }
        config_dict = {
            'service_id': FAKE_SERVICE_ID,
            'pod_id': FAKE_SITE_ID,
            'service_type': FAKE_TYPE,
            'service_url': FAKE_URL
        }
        api.create_pod(self.context, pod_dict)
        api.create_cached_endpoints(self.context, config_dict)

        global FAKE_RESOURCES
        FAKE_RESOURCES = [{'name': 'res1'}, {'name': 'res2'}]

        cfg.CONF.set_override(name='top_region_name',
                              override=FAKE_SITE_NAME,
                              group='client')
        self.client = client.Client()
        self.client.resource_service_map[FAKE_RESOURCE] = FAKE_TYPE
        self.client.operation_resources_map['list'].add(FAKE_RESOURCE)
        self.client.operation_resources_map['create'].add(FAKE_RESOURCE)
        self.client.operation_resources_map['delete'].add(FAKE_RESOURCE)
        self.client.operation_resources_map['action'].add(FAKE_RESOURCE)
        self.client.service_handle_map[FAKE_TYPE] = FakeResHandle(None)
 def setUp(self):
     core.initialize()
     core.ModelBase.metadata.create_all(core.get_engine())
     core.get_engine().execute('pragma foreign_keys=on')
     self.context = context.Context()
     xmanager.IN_TEST = True
     directory.get_plugin = fake_get_plugin
Esempio n. 5
0
    def setUp(self):
        core.initialize()
        core.ModelBase.metadata.create_all(core.get_engine())
        # enforce foreign key constraint for sqlite
        core.get_engine().execute('pragma foreign_keys=on')
        self.context = context.Context()

        site_dict = {
            'site_id': FAKE_SITE_ID,
            'site_name': FAKE_SITE_NAME,
            'az_id': FAKE_AZ
        }
        config_dict = {
            'service_id': FAKE_SERVICE_ID,
            'site_id': FAKE_SITE_ID,
            'service_type': FAKE_TYPE,
            'service_url': FAKE_URL
        }
        models.create_site(self.context, site_dict)
        models.create_site_service_configuration(self.context, config_dict)

        global FAKE_RESOURCES
        FAKE_RESOURCES = [{'name': 'res1'}, {'name': 'res2'}]

        cfg.CONF.set_override(name='top_site_name', override=FAKE_SITE_NAME,
                              group='client')
        self.client = client.Client()
        self.client.resource_service_map[FAKE_RESOURCE] = FAKE_TYPE
        self.client.operation_resources_map['list'].add(FAKE_RESOURCE)
        self.client.operation_resources_map['create'].add(FAKE_RESOURCE)
        self.client.operation_resources_map['delete'].add(FAKE_RESOURCE)
        self.client.operation_resources_map['action'].add(FAKE_RESOURCE)
        self.client.service_handle_map[FAKE_TYPE] = FakeResHandle(None)
Esempio n. 6
0
 def setUp(self):
     core.initialize()
     core.ModelBase.metadata.create_all(core.get_engine())
     # enforce foreign key constraint for sqlite
     core.get_engine().execute('pragma foreign_keys=on')
     for opt in xservice.common_opts:
         if opt.name in ('worker_handle_timeout', 'job_run_expire',
                         'worker_sleep_time', 'redo_time_span'):
             cfg.CONF.register_opt(opt)
     self.context = context.Context()
     self.xmanager = FakeXManager()
Esempio n. 7
0
 def setUp(self):
     core.initialize()
     core.ModelBase.metadata.create_all(core.get_engine())
     # enforce foreign key constraint for sqlite
     core.get_engine().execute('pragma foreign_keys=on')
     for opt in xservice.common_opts:
         if opt.name in ('worker_handle_timeout', 'job_run_expire',
                         'worker_sleep_time'):
             cfg.CONF.register_opt(opt)
     self.context = context.Context()
     self.xmanager = FakeXManager()
Esempio n. 8
0
    def setUp(self):
        core.initialize()
        core.ModelBase.metadata.create_all(core.get_engine())
        # enforce foreign key constraint for sqlite
        core.get_engine().execute('pragma foreign_keys=on')
        self.context = context.Context()

        top_pod = {
            'pod_id': FAKE_TOP_ID,
            'pod_name': FAKE_TOP_NAME,
            'az_name': ''
        }

        config_dict_top = {
            'service_id': FAKE_TOP_SERVICE_ID,
            'pod_id': FAKE_TOP_ID,
            'service_type': FAKE_SERVICE_TYPE,
            'service_url': FAKE_TOP_ENDPOINT
        }

        pod_dict = {
            'pod_id': FAKE_SITE_ID,
            'pod_name': FAKE_SITE_NAME,
            'az_name': FAKE_AZ
        }

        pod_dict2 = {
            'pod_id': FAKE_SITE_ID_2,
            'pod_name': FAKE_SITE_NAME_2,
            'az_name': FAKE_AZ
        }

        config_dict = {
            'service_id': FAKE_SERVICE_ID,
            'pod_id': FAKE_SITE_ID,
            'service_type': FAKE_SERVICE_TYPE,
            'service_url': FAKE_SERVICE_ENDPOINT
        }

        config_dict2 = {
            'service_id': FAKE_SERVICE_ID_2,
            'pod_id': FAKE_SITE_ID_2,
            'service_type': FAKE_SERVICE_TYPE,
            'service_url': FAKE_SERVICE_ENDPOINT_2
        }

        api.create_pod(self.context, pod_dict)
        api.create_pod(self.context, pod_dict2)
        api.create_pod(self.context, top_pod)
        api.create_pod_service_configuration(self.context, config_dict)
        api.create_pod_service_configuration(self.context, config_dict2)
        api.create_pod_service_configuration(self.context, config_dict_top)
Esempio n. 9
0
    def _init_db(self):
        core.initialize()
        core.ModelBase.metadata.create_all(core.get_engine())
        # enforce foreign key constraint for sqlite
        core.get_engine().execute('pragma foreign_keys=on')
        self.context = context.Context()

        pod_dict = {
            'pod_id': 'fake_pod_id',
            'pod_name': 'fake_pod_name',
            'az_name': FAKE_AZ
        }

        config_dict = {
            'service_id': 'fake_service_id',
            'pod_id': 'fake_pod_id',
            'service_type': cons.ST_NOVA,
            'service_url': 'http://127.0.0.1:8774/v2/$(tenant_id)s'
        }

        pod_dict2 = {
            'pod_id': 'fake_pod_id' + '2',
            'pod_name': 'fake_pod_name' + '2',
            'az_name': FAKE_AZ + '2'
        }

        config_dict2 = {
            'service_id': 'fake_service_id' + '2',
            'pod_id': 'fake_pod_id' + '2',
            'service_type': cons.ST_CINDER,
            'service_url': 'http://10.0.0.2:8774/v2/$(tenant_id)s'
        }

        top_pod = {
            'pod_id': 'fake_top_pod_id',
            'pod_name': 'RegionOne',
            'az_name': ''
        }

        top_config = {
            'service_id': 'fake_top_service_id',
            'pod_id': 'fake_top_pod_id',
            'service_type': cons.ST_CINDER,
            'service_url': 'http://127.0.0.1:19998/v2/$(tenant_id)s'
        }

        db_api.create_pod(self.context, pod_dict)
        db_api.create_pod(self.context, pod_dict2)
        db_api.create_pod(self.context, top_pod)
        db_api.create_pod_service_configuration(self.context, config_dict)
        db_api.create_pod_service_configuration(self.context, config_dict2)
        db_api.create_pod_service_configuration(self.context, top_config)
Esempio n. 10
0
    def _init_db(self):
        core.initialize()
        core.ModelBase.metadata.create_all(core.get_engine())
        # enforce foreign key constraint for sqlite
        core.get_engine().execute('pragma foreign_keys=on')
        self.context = context.Context()

        pod_dict = {
            'pod_id': 'fake_pod_id',
            'pod_name': 'fake_pod_name',
            'az_name': FAKE_AZ
        }

        config_dict = {
            'service_id': 'fake_service_id',
            'pod_id': 'fake_pod_id',
            'service_type': cons.ST_CINDER,
            'service_url': 'http://127.0.0.1:8774/v2/$(tenant_id)s'
        }

        pod_dict2 = {
            'pod_id': 'fake_pod_id' + '2',
            'pod_name': 'fake_pod_name' + '2',
            'az_name': FAKE_AZ + '2'
        }

        config_dict2 = {
            'service_id': 'fake_service_id' + '2',
            'pod_id': 'fake_pod_id' + '2',
            'service_type': cons.ST_CINDER,
            'service_url': 'http://10.0.0.2:8774/v2/$(tenant_id)s'
        }

        top_pod = {
            'pod_id': 'fake_top_pod_id',
            'pod_name': 'RegionOne',
            'az_name': ''
        }

        top_config = {
            'service_id': 'fake_top_service_id',
            'pod_id': 'fake_top_pod_id',
            'service_type': cons.ST_CINDER,
            'service_url': 'http://127.0.0.1:19998/v2/$(tenant_id)s'
        }

        db_api.create_pod(self.context, pod_dict)
        db_api.create_pod(self.context, pod_dict2)
        db_api.create_pod(self.context, top_pod)
        db_api.create_pod_service_configuration(self.context, config_dict)
        db_api.create_pod_service_configuration(self.context, config_dict2)
        db_api.create_pod_service_configuration(self.context, top_config)
Esempio n. 11
0
 def setUp(self):
     core.initialize()
     core.ModelBase.metadata.create_all(core.get_engine())
     self.context = context.Context()
     self.project_id = 'test_project'
     self.context.tenant = self.project_id
     self.controller = action.VolumeActionController(self.project_id, '')
Esempio n. 12
0
 def setUp(self):
     core.initialize()
     core.ModelBase.metadata.create_all(core.get_engine())
     self.controller = FakeAsyncJobController()
     self.context = context.get_admin_context()
     self.job_resource_map = constants.job_resource_map
     policy.populate_default_rules()
Esempio n. 13
0
    def setUp(self):
        super(RoutingControllerTest, self).setUp()

        cfg.CONF.clear()
        cfg.CONF.register_opts(app.common_opts)
        core.initialize()
        core.ModelBase.metadata.create_all(core.get_engine())
        self.controller = routing.RoutingController()
        self.context = context.get_admin_context()
        policy.populate_default_rules()
Esempio n. 14
0
    def setUp(self):
        super(RoutingControllerTest, self).setUp()

        cfg.CONF.clear()
        cfg.CONF.register_opts(app.common_opts)
        core.initialize()
        core.ModelBase.metadata.create_all(core.get_engine())
        self.controller = routing.RoutingController()
        self.context = context.get_admin_context()
        policy.populate_default_rules()
Esempio n. 15
0
    def setUp(self):
        super(AsyncJobControllerTest, self).setUp()

        cfg.CONF.clear()
        cfg.CONF.register_opts(app.common_opts)
        core.initialize()
        core.ModelBase.metadata.create_all(core.get_engine())
        self.controller = FakeAsyncJobController()
        self.context = context.get_admin_context()
        self.job_resource_map = constants.job_resource_map
        policy.populate_default_rules()
Esempio n. 16
0
    def setUp(self):
        super(AsyncJobControllerTest, self).setUp()

        cfg.CONF.clear()
        cfg.CONF.register_opts(app.common_opts)
        core.initialize()
        core.ModelBase.metadata.create_all(core.get_engine())
        self.controller = FakeAsyncJobController()
        self.context = context.get_admin_context()
        self.job_resource_map = constants.job_resource_map
        policy.populate_default_rules()
    def setUp(self):
        core.initialize()
        core.ModelBase.metadata.create_all(core.get_engine())
        self.context = context.Context()
        xmanager.IN_TEST = True

        def fake_get_plugin(alias='core'):
            if alias == 'trunk':
                return FakePlugin()
            return FakeCorePlugin()
        directory.get_plugin = fake_get_plugin
    def setUp(self):
        core.initialize()
        core.ModelBase.metadata.create_all(core.get_engine())
        self.context = context.Context()
        xmanager.IN_TEST = True

        def fake_get_plugin(alias='core'):
            if alias == 'trunk':
                return FakePlugin()
            return FakeCorePlugin()
        directory.get_plugin = fake_get_plugin
Esempio n. 19
0
    def setUp(self):
        core.initialize()
        core.ModelBase.metadata.create_all(core.get_engine())
        self.context = context.Context()
        self.context.is_admin = True

        root_controller._get_environment = mock.Mock(return_value={})
        root_controller._extract_context_from_environ = mock.Mock(
            return_value=self.context)

        pecan.abort = mock.Mock()
        pecan.response = mock.Mock()
Esempio n. 20
0
    def setUp(self):
        core.initialize()
        core.ModelBase.metadata.create_all(core.get_engine())
        self.context = context.Context()
        self.context.is_admin = True

        root_controller._get_environment = mock.Mock(return_value={})
        root_controller._extract_context_from_environ = mock.Mock(
            return_value=self.context)

        pecan.abort = mock.Mock()
        pecan.response = mock.Mock()
    def setUp(self):
        core.initialize()
        core.ModelBase.metadata.create_all(core.get_engine())
        self.context = context.Context()
        cfg.CONF.set_override('tenant_network_types', ['local', 'vlan'],
                              group='tricircle')
        cfg.CONF.set_override('bridge_network_type', 'vlan',
                              group='tricircle')
        xmanager.IN_TEST = True

        def fake_get_plugin(alias='core'):
            if alias == 'trunk':
                return FakePlugin()
            return FakeCorePlugin()
        directory.get_plugin = fake_get_plugin
    def setUp(self):
        core.initialize()
        core.ModelBase.metadata.create_all(core.get_engine())
        self.context = context.Context()
        cfg.CONF.set_override('tenant_network_types', ['local', 'vlan'],
                              group='tricircle')
        cfg.CONF.set_override('bridge_network_type', 'vlan', group='tricircle')
        xmanager.IN_TEST = True

        def fake_get_plugin(alias='core'):
            if alias == 'trunk':
                return FakePlugin()
            return FakeCorePlugin()

        directory.get_plugin = fake_get_plugin
Esempio n. 23
0
    def setUp(self):
        super(API_FunctionalTest, self).setUp()

        self.addCleanup(set_config, {}, overwrite=True)

        cfg.CONF.register_opts(app.common_opts)

        self.CONF = self.useFixture(fixture_config.Config()).conf

        self.CONF.set_override('auth_strategy', 'noauth')
        self.CONF.set_override('tricircle_db_connection', 'sqlite:///:memory:')

        core.initialize()
        core.ModelBase.metadata.create_all(core.get_engine())

        self.context = context.get_admin_context()

        self.app = self._make_app()
Esempio n. 24
0
    def setUp(self):
        super(MicroVersionFunctionTest, self).setUp()

        self.addCleanup(set_config, {}, overwrite=True)

        cfg.CONF.register_opts(app.common_opts)

        self.CONF = self.useFixture(fixture_config.Config()).conf

        self.CONF.set_override('auth_strategy', 'noauth')
        self.CONF.set_override('tricircle_db_connection', 'sqlite:///:memory:')

        core.initialize()
        core.ModelBase.metadata.create_all(core.get_engine())

        self.app = self._make_app()

        self._init_db()
Esempio n. 25
0
    def setUp(self):
        super(API_FunctionalTest, self).setUp()

        self.addCleanup(set_config, {}, overwrite=True)

        cfg.CONF.clear()
        cfg.CONF.register_opts(app.common_opts)

        self.CONF = self.useFixture(fixture_config.Config()).conf

        self.CONF.set_override('auth_strategy', 'noauth')
        self.CONF.set_override('tricircle_db_connection', 'sqlite:///:memory:')

        core.initialize()
        core.ModelBase.metadata.create_all(core.get_engine())

        self.context = context.get_admin_context()

        policy.populate_default_rules()

        self.app = self._make_app()
Esempio n. 26
0
    def setUp(self):
        core.initialize()
        core.ModelBase.metadata.create_all(core.get_engine())

        cfg.CONF.register_opts(q_config.core_opts)
        cfg.CONF.register_opts(plugin.tricircle_opts)
        cfg.CONF.set_override('enable_l3_route_network', True,
                              group='tricircle')
        plugin_path = \
            'tricircle.tests.unit.network.test_central_plugin.FakePlugin'
        cfg.CONF.set_override('core_plugin', plugin_path)
        cfg.CONF.set_override('enable_api_gateway', True)
        self.context = context.Context()

        phynet = 'bridge'
        phynet2 = 'bridge2'
        vlan_min, vlan_max = 2000, 3000
        cfg.CONF.set_override('type_drivers', ['local', 'vlan'],
                              group='tricircle')
        cfg.CONF.set_override('tenant_network_types', ['local', 'vlan'],
                              group='tricircle')
        cfg.CONF.set_override('network_vlan_ranges',
                              ['%s:%d:%d' % (phynet, vlan_min, vlan_max),
                               '%s:%d:%d' % (phynet2, vlan_min, vlan_max)],
                              group='tricircle')
        cfg.CONF.set_override('bridge_network_type', 'vlan',
                              group='tricircle')

        def fake_get_plugin(alias=plugin_constants.CORE):
            if alias == 'trunk':
                return FakeTrunkPlugin()
            return CentralFakePlugin()
        from neutron_lib.plugins import directory
        directory.get_plugin = fake_get_plugin

        global segments_plugin
        segments_plugin = FakePlugin()
Esempio n. 27
0
 def setUp(self):
     core.initialize()
     core.ModelBase.metadata.create_all(core.get_engine())
     self.controller = pod.PodsController()
     self.context = context.get_admin_context()
Esempio n. 28
0
 def setUp(self):
     core.initialize()
     core.ModelBase.metadata.create_all(core.get_engine())
     self.project_id = 'project_id'
     self.t_ctx = context.Context()
     self.q_ctx = object()
Esempio n. 29
0
 def tearDown(self):
     super(API_FunctionalTest, self).tearDown()
     cfg.CONF.unregister_opts(app.common_opts)
     pecan.set_config({}, overwrite=True)
     core.ModelBase.metadata.drop_all(core.get_engine())
     policy.reset()
Esempio n. 30
0
 def tearDown(self):
     core.ModelBase.metadata.drop_all(core.get_engine())
Esempio n. 31
0
 def tearDown(self):
     super(API_FunctionalTest, self).tearDown()
     cfg.CONF.unregister_opts(app.common_opts)
     pecan.set_config({}, overwrite=True)
     core.ModelBase.metadata.drop_all(core.get_engine())
     policy.reset()
Esempio n. 32
0
 def setUp(self):
     core.initialize()
     core.ModelBase.metadata.create_all(core.get_engine())
     # enforce foreign key constraint for sqlite
     core.get_engine().execute('pragma foreign_keys=on')
     self.context = context.Context()
Esempio n. 33
0
 def setUp(self):
     core.initialize()
     core.ModelBase.metadata.create_all(core.get_engine())
     self.project_id = 'project_id'
     self.t_ctx = context.Context()
     self.q_ctx = object()
Esempio n. 34
0
 def tearDown(self):
     core.ModelBase.metadata.drop_all(core.get_engine())
     test_utils.get_resource_store().clean()
     cfg.CONF.unregister_opts(q_config.core_opts)
     cfg.CONF.unregister_opts(plugin.tricircle_opts)
Esempio n. 35
0
 def setUp(self):
     core.initialize()
     core.ModelBase.metadata.create_all(core.get_engine())
     self.context = context.get_admin_context()
     self.project_id = 'test_project'
     self.controller = volume.VolumeController(self.project_id, '')
 def tearDown(self):
     core.ModelBase.metadata.drop_all(core.get_engine())
     test_utils.get_resource_store().clean()
     cfg.CONF.unregister_opts(q_config.core_opts)
     xmanager.IN_TEST = False
Esempio n. 37
0
 def tearDown(self):
     super(CinderVolumeFunctionalTest, self).tearDown()
     cfg.CONF.unregister_opts(app.common_opts)
     pecan.set_config({}, overwrite=True)
     core.ModelBase.metadata.drop_all(core.get_engine())
     del fake_volumes[:]
Esempio n. 38
0
 def tearDown(self):
     super(CinderVolumeFunctionalTest, self).tearDown()
     cfg.CONF.unregister_opts(app.common_opts)
     pecan.set_config({}, overwrite=True)
     core.ModelBase.metadata.drop_all(core.get_engine())
     del fake_volumes[:]
Esempio n. 39
0
 def setUp(self):
     core.initialize()
     core.ModelBase.metadata.create_all(core.get_engine())
     cfg.CONF.register_opts(q_config.core_opts)
     self.helper = helper.NetworkHelper()
     self.context = context.Context()
Esempio n. 40
0
 def setUp(self):
     core.initialize()
     core.ModelBase.metadata.create_all(core.get_engine())
     self.context = context.Context()
     self.project_id = 'test_project'
     self.controller = FakeServerController(self.project_id)
Esempio n. 41
0
    def tearDown(self):
        cfg.CONF.unregister_opts(app.common_opts)
        core.ModelBase.metadata.drop_all(core.get_engine())

        super(RoutingControllerTest, self).tearDown()
Esempio n. 42
0
    def tearDown(self):
        cfg.CONF.unregister_opts(app.common_opts)
        core.ModelBase.metadata.drop_all(core.get_engine())

        super(RoutingControllerTest, self).tearDown()
Esempio n. 43
0
def sync_repo(version):
    repo_abs_path = find_migrate_repo()
    init_version = migrate_repo.DB_INIT_VERSION
    engine = core.get_engine()
    migration.db_sync(engine, repo_abs_path, version, init_version)
Esempio n. 44
0
 def setUp(self):
     core.initialize()
     core.ModelBase.metadata.create_all(core.get_engine())
     self.context = context.Context()
Esempio n. 45
0
 def setUp(self):
     core.initialize()
     core.ModelBase.metadata.create_all(core.get_engine())
     self.controller = routing.RoutingController()
     self.context = context.get_admin_context()
     policy.populate_default_rules()
Esempio n. 46
0
 def setUp(self):
     core.initialize()
     core.ModelBase.metadata.create_all(core.get_engine())
     self.context = context.get_admin_context()
     self.project_id = 'test_project'
     self.controller = action.ActionController(self.project_id, '')
Esempio n. 47
0
 def tearDown(self):
     core.ModelBase.metadata.drop_all(core.get_engine())
Esempio n. 48
0
 def setUp(self):
     core.initialize()
     core.ModelBase.metadata.create_all(core.get_engine())
     self.controller = routing.RoutingController()
     self.context = context.get_admin_context()
     policy.populate_default_rules()
Esempio n. 49
0
 def setUp(self):
     core.initialize()
     core.ModelBase.metadata.create_all(core.get_engine())
     self.context = context.Context()
Esempio n. 50
0
 def tearDown(self):
     super(QuotaControllerTest, self).tearDown()
     pecan.set_config({}, overwrite=True)
     cfg.CONF.unregister_opts(app.common_opts)
     core.ModelBase.metadata.drop_all(core.get_engine())
Esempio n. 51
0
 def tearDown(self):
     core.ModelBase.metadata.drop_all(core.get_engine())
     for res in RES_LIST:
         del res[:]
Esempio n. 52
0
 def tearDown(self):
     core.ModelBase.metadata.drop_all(core.get_engine())
     for res in RES_LIST:
         del res[:]
 def tearDown(self):
     core.ModelBase.metadata.drop_all(core.get_engine())
     test_utils.get_resource_store().clean()
     cfg.CONF.unregister_opts(q_config.core_opts)
     xmanager.IN_TEST = False
Esempio n. 54
0
 def setUp(self):
     core.initialize()
     core.ModelBase.metadata.create_all(core.get_engine())
     self.context = context.Context()
     self.project_id = 'test_project'
     self.controller = FakeServerController(self.project_id)