def setUp(self): super(TestSubnetsClient, self).setUp() fake_auth = fake_auth_provider.FakeAuthProvider() self.subnets_client = subnets_client.SubnetsClient( fake_auth, 'compute', 'regionOne')
def __init__(self, user, pw, tenant): default_params = { 'disable_ssl_certificate_validation': CONF.identity.disable_ssl_certificate_validation, 'ca_certs': CONF.identity.ca_certificates_file, 'trace_requests': CONF.debug.trace_requests } default_params_with_timeout_values = { 'build_interval': CONF.compute.build_interval, 'build_timeout': CONF.compute.build_timeout } default_params_with_timeout_values.update(default_params) compute_params = { 'service': CONF.compute.catalog_type, 'region': CONF.compute.region or CONF.identity.region, 'endpoint_type': CONF.compute.endpoint_type, 'build_interval': CONF.compute.build_interval, 'build_timeout': CONF.compute.build_timeout } compute_params.update(default_params) object_storage_params = { 'service': CONF.object_storage.catalog_type, 'region': CONF.object_storage.region or CONF.identity.region, 'endpoint_type': CONF.object_storage.endpoint_type } object_storage_params.update(default_params) _creds = auth.KeystoneV2Credentials(username=user, password=pw, tenant_name=tenant) auth_provider_params = { 'disable_ssl_certificate_validation': CONF.identity.disable_ssl_certificate_validation, 'ca_certs': CONF.identity.ca_certificates_file, 'trace_requests': CONF.debug.trace_requests } _auth = auth.KeystoneV2AuthProvider(_creds, CONF.identity.uri, **auth_provider_params) self.identity = identity_client.IdentityClient( _auth, CONF.identity.catalog_type, CONF.identity.region, endpoint_type='adminURL', **default_params_with_timeout_values) self.tenants = tenants_client.TenantsClient( _auth, CONF.identity.catalog_type, CONF.identity.region, endpoint_type='adminURL', **default_params_with_timeout_values) self.roles = roles_client.RolesClient( _auth, CONF.identity.catalog_type, CONF.identity.region, endpoint_type='adminURL', **default_params_with_timeout_values) self.users = users_client.UsersClient( _auth, CONF.identity.catalog_type, CONF.identity.region, endpoint_type='adminURL', **default_params_with_timeout_values) self.servers = servers_client.ServersClient(_auth, **compute_params) self.flavors = flavors_client.FlavorsClient(_auth, **compute_params) self.floating_ips = floating_ips_client.FloatingIPsClient( _auth, **compute_params) self.secgroups = security_groups_client.SecurityGroupsClient( _auth, **compute_params) self.secrules = security_group_rules_client.SecurityGroupRulesClient( _auth, **compute_params) self.objects = object_client.ObjectClient(_auth, **object_storage_params) self.containers = container_client.ContainerClient( _auth, **object_storage_params) self.images = images_client.ImagesClientV2( _auth, CONF.image.catalog_type, CONF.image.region or CONF.identity.region, endpoint_type=CONF.image.endpoint_type, build_interval=CONF.image.build_interval, build_timeout=CONF.image.build_timeout, **default_params) self.volumes = volumes_client.VolumesClient( _auth, CONF.volume.catalog_type, CONF.volume.region or CONF.identity.region, endpoint_type=CONF.volume.endpoint_type, build_interval=CONF.volume.build_interval, build_timeout=CONF.volume.build_timeout, **default_params) self.networks = networks_client.NetworksClient( _auth, CONF.network.catalog_type, CONF.network.region or CONF.identity.region, endpoint_type=CONF.network.endpoint_type, build_interval=CONF.network.build_interval, build_timeout=CONF.network.build_timeout, **default_params) self.ports = ports_client.PortsClient( _auth, CONF.network.catalog_type, CONF.network.region or CONF.identity.region, endpoint_type=CONF.network.endpoint_type, build_interval=CONF.network.build_interval, build_timeout=CONF.network.build_timeout, **default_params) self.routers = routers_client.RoutersClient( _auth, CONF.network.catalog_type, CONF.network.region or CONF.identity.region, endpoint_type=CONF.network.endpoint_type, build_interval=CONF.network.build_interval, build_timeout=CONF.network.build_timeout, **default_params) self.subnets = subnets_client.SubnetsClient( _auth, CONF.network.catalog_type, CONF.network.region or CONF.identity.region, endpoint_type=CONF.network.endpoint_type, build_interval=CONF.network.build_interval, build_timeout=CONF.network.build_timeout, **default_params)
def get_admin_clients(opts): _creds = tempest.lib.auth.KeystoneV2Credentials( username=opts.os_username, password=opts.os_password, tenant_name=opts.os_tenant_name) auth_params = { 'disable_ssl_certificate_validation': CONF.identity.disable_ssl_certificate_validation, 'ca_certs': CONF.identity.ca_certificates_file, 'trace_requests': CONF.debug.trace_requests } _auth = tempest.lib.auth.KeystoneV2AuthProvider(_creds, CONF.identity.uri, **auth_params) params = { 'disable_ssl_certificate_validation': CONF.identity.disable_ssl_certificate_validation, 'ca_certs': CONF.identity.ca_certificates_file, 'trace_requests': CONF.debug.trace_requests, 'build_interval': CONF.compute.build_interval, 'build_timeout': CONF.compute.build_timeout } identity_admin = identity_client.IdentityClient(_auth, CONF.identity.catalog_type, CONF.identity.region, endpoint_type='adminURL', **params) tenants_admin = tenants_client.TenantsClient(_auth, CONF.identity.catalog_type, CONF.identity.region, endpoint_type='adminURL', **params) roles_admin = roles_client.RolesClient(_auth, CONF.identity.catalog_type, CONF.identity.region, endpoint_type='adminURL', **params) users_admin = users_client.UsersClient(_auth, CONF.identity.catalog_type, CONF.identity.region, endpoint_type='adminURL', **params) networks_admin = None routers_admin = None subnets_admin = None neutron_iso_networks = False if (CONF.service_available.neutron and CONF.auth.create_isolated_networks): neutron_iso_networks = True networks_admin = networks_client.NetworksClient( _auth, CONF.network.catalog_type, CONF.network.region or CONF.identity.region, endpoint_type='adminURL', **params) routers_admin = routers_client.RoutersClient(_auth, CONF.network.catalog_type, CONF.network.region or CONF.identity.region, endpoint_type='adminURL', **params) subnets_admin = subnets_client.SubnetsClient(_auth, CONF.network.catalog_type, CONF.network.region or CONF.identity.region, endpoint_type='adminURL', **params) return (identity_admin, tenants_admin, roles_admin, users_admin, neutron_iso_networks, networks_admin, routers_admin, subnets_admin)