def test_get_dynamic_provider_params_no_creds(self):
     expected_identity_version = 'v3'
     with mock.patch.object(
             cf, 'get_configured_admin_credentials') as admin_creds_mock:
         cf.get_dynamic_provider_params(expected_identity_version)
         admin_creds_mock.assert_called_once_with(
             fill_in=True, identity_version=expected_identity_version)
 def test_get_dynamic_provider_params_no_creds(self):
     expected_identity_version = 'v3'
     with mock.patch.object(
             cf, 'get_configured_admin_credentials') as admin_creds_mock:
         cf.get_dynamic_provider_params(expected_identity_version)
         admin_creds_mock.assert_called_once_with(
             fill_in=True, identity_version=expected_identity_version)
 def test_get_dynamic_provider_params_creds_vx(self):
     admin_creds = fake_credentials.FakeCredentials()
     invalid_version = 'invalid_version_x'
     with testtools.ExpectedException(
             exc_type=exceptions.InvalidIdentityVersion,
             value_re='Invalid version ' + invalid_version):
         cf.get_dynamic_provider_params(invalid_version,
                                        admin_creds=admin_creds)
 def test_get_dynamic_provider_params_creds_vx(self):
     admin_creds = fake_credentials.FakeCredentials()
     invalid_version = 'invalid_version_x'
     with testtools.ExpectedException(
             exc_type=exceptions.InvalidIdentityVersion,
             value_re='Invalid version ' + invalid_version):
         cf.get_dynamic_provider_params(invalid_version,
                                        admin_creds=admin_creds)
示例#5
0
def get_credential_provider(opts):
    identity_version = "".join(['v', str(opts.identity_version)])
    # NOTE(andreaf) For now tempest.conf controls whether resources will
    # actually be created. Once we remove the dependency from tempest.conf
    # we will need extra CLI option(s) to control this.
    network_resources = {
        'router': True,
        'network': True,
        'subnet': True,
        'dhcp': True
    }
    admin_creds_dict = {
        'username': opts.os_username,
        'password': opts.os_password
    }
    _project_name = opts.os_project_name or opts.os_tenant_name
    if opts.identity_version == 3:
        admin_creds_dict['project_name'] = _project_name
        admin_creds_dict['domain_name'] = opts.os_domain_name or 'Default'
    elif opts.identity_version == 2:
        admin_creds_dict['tenant_name'] = _project_name
    admin_creds = credentials_factory.get_credentials(
        fill_in=False, identity_version=identity_version, **admin_creds_dict)
    return dynamic_creds.DynamicCredentialProvider(
        name=opts.tag,
        network_resources=network_resources,
        **credentials_factory.get_dynamic_provider_params(
            identity_version, admin_creds=admin_creds))
def get_credential_provider(opts):
    identity_version = "".join(['v', str(opts.identity_version)])
    # NOTE(andreaf) For now tempest.conf controls whether resources will
    # actually be created. Once we remove the dependency from tempest.conf
    # we will need extra CLI option(s) to control this.
    network_resources = {'router': True,
                         'network': True,
                         'subnet': True,
                         'dhcp': True}
    admin_creds_dict = {'username': opts.os_username,
                        'password': opts.os_password}
    _project_name = opts.os_project_name or opts.os_tenant_name
    if opts.identity_version == 3:
        admin_creds_dict['project_name'] = _project_name
        admin_creds_dict['domain_name'] = opts.os_domain_name or 'Default'
    elif opts.identity_version == 2:
        admin_creds_dict['tenant_name'] = _project_name
    admin_creds = credentials_factory.get_credentials(
        fill_in=False, identity_version=identity_version, **admin_creds_dict)
    return dynamic_creds.DynamicCredentialProvider(
        identity_version=identity_version,
        name=opts.tag,
        network_resources=network_resources,
        neutron_available=CONF.service_available.neutron,
        create_networks=CONF.auth.create_isolated_networks,
        identity_admin_role=CONF.identity.admin_role,
        identity_admin_domain_scope=CONF.identity.admin_domain_scope,
        project_network_cidr=CONF.network.project_network_cidr,
        project_network_mask_bits=CONF.network.project_network_mask_bits,
        public_network_id=CONF.network.public_network_id,
        admin_creds=admin_creds,
        **credentials_factory.get_dynamic_provider_params())
示例#7
0
def get_credential_provider(opts):
    identity_version = "".join(['v', str(opts.identity_version)])
    # NOTE(andreaf) For now tempest.conf controls whether resources will
    # actually be created. Once we remove the dependency from tempest.conf
    # we will need extra CLI option(s) to control this.
    network_resources = {'router': True,
                         'network': True,
                         'subnet': True,
                         'dhcp': True}
    admin_creds_dict = {'username': opts.os_username,
                        'password': opts.os_password}
    _project_name = opts.os_project_name or opts.os_tenant_name
    if opts.identity_version == 3:
        admin_creds_dict['project_name'] = _project_name
        admin_creds_dict['domain_name'] = opts.os_domain_name or 'Default'
    elif opts.identity_version == 2:
        admin_creds_dict['tenant_name'] = _project_name
    admin_creds = credentials_factory.get_credentials(
        fill_in=False, identity_version=identity_version, **admin_creds_dict)
    return dynamic_creds.DynamicCredentialProvider(
        identity_version=identity_version,
        name=opts.tag,
        network_resources=network_resources,
        admin_creds=admin_creds,
        **credentials_factory.get_dynamic_provider_params())
 def test_get_dynamic_provider_params_creds_v3(self):
     expected_uri = 'EXPECTED_V3_URI'
     cfg.CONF.set_default('uri_v3', expected_uri, group='identity')
     admin_creds = fake_credentials.FakeCredentials()
     params = cf.get_dynamic_provider_params('v3', admin_creds=admin_creds)
     expected_params = dict(identity_uri=expected_uri,
                            admin_creds=admin_creds)
     for key in expected_params:
         self.assertIn(key, params)
         self.assertEqual(expected_params[key], params[key])
 def test_get_dynamic_provider_params_creds_v3(self):
     expected_uri = 'EXPECTED_V3_URI'
     cfg.CONF.set_default('uri_v3', expected_uri, group='identity')
     admin_creds = fake_credentials.FakeCredentials()
     params = cf.get_dynamic_provider_params('v3', admin_creds=admin_creds)
     expected_params = dict(identity_uri=expected_uri,
                            admin_creds=admin_creds)
     for key in expected_params:
         self.assertIn(key, params)
         self.assertEqual(expected_params[key], params[key])
示例#10
0
def get_credential_provider(opts):
    identity_version = "".join(['v', str(opts.identity_version)])
    # NOTE(andreaf) For now tempest.conf controls whether resources will
    # actually be created. Once we remove the dependency from tempest.conf
    # we will need extra CLI option(s) to control this.
    network_resources = {
        'router': True,
        'network': True,
        'subnet': True,
        'dhcp': True
    }
    admin_creds_dict = {
        'username': opts.os_username,
        'password': opts.os_password
    }
    _project_name = opts.os_project_name or opts.os_tenant_name
    if opts.identity_version == 3:
        admin_creds_dict['project_name'] = _project_name
        admin_creds_dict['domain_name'] = opts.os_domain_name or 'Default'
    elif opts.identity_version == 2:
        admin_creds_dict['tenant_name'] = _project_name
    admin_creds = credentials_factory.get_credentials(
        fill_in=False, identity_version=identity_version, **admin_creds_dict)
    return dynamic_creds.DynamicCredentialProvider(
        identity_version=identity_version,
        name=opts.tag,
        network_resources=network_resources,
        neutron_available=CONF.service_available.neutron,
        create_networks=CONF.auth.create_isolated_networks,
        identity_admin_role=CONF.identity.admin_role,
        identity_admin_domain_scope=CONF.identity.admin_domain_scope,
        project_network_cidr=CONF.network.project_network_cidr,
        project_network_mask_bits=CONF.network.project_network_mask_bits,
        public_network_id=CONF.network.public_network_id,
        admin_creds=admin_creds,
        **credentials_factory.get_dynamic_provider_params())
 def test_get_preprov_provider_params_creds_vx(self):
     invalid_version = 'invalid_version_x'
     with testtools.ExpectedException(
             exc_type=exceptions.InvalidIdentityVersion,
             value_re='Invalid version ' + invalid_version):
         cf.get_dynamic_provider_params(invalid_version)
示例#12
0
 def test_get_preprov_provider_params_creds_vx(self):
     invalid_version = 'invalid_version_x'
     with testtools.ExpectedException(
             exc_type=exceptions.InvalidIdentityVersion,
             value_re='Invalid version ' + invalid_version):
         cf.get_dynamic_provider_params(invalid_version)