def __init__(self, cloud_prefix='SRC'): self.filtering_utils = FilteringUtils() self.username = os.environ['%s_OS_USERNAME' % cloud_prefix] self.password = os.environ['%s_OS_PASSWORD' % cloud_prefix] self.tenant = os.environ['%s_OS_TENANT_NAME' % cloud_prefix] self.auth_url = os.environ['%s_OS_AUTH_URL' % cloud_prefix] self.image_endpoint = os.environ['%s_OS_IMAGE_ENDPOINT' % cloud_prefix] self.neutron_endpoint = os.environ['%s_OS_NEUTRON_ENDPOINT' % cloud_prefix] self.keystoneclient = keystone.Client(auth_url=self.auth_url, username=self.username, password=self.password, tenant_name=self.tenant) self.keystoneclient.authenticate() self.token = self.keystoneclient.auth_token self.novaclient = nova.Client(NOVA_CLIENT_VERSION, username=self.username, api_key=self.password, project_id=self.tenant, auth_url=self.auth_url) self.glanceclient = glance(GLANCE_CLIENT_VERSION, endpoint=self.image_endpoint, token=self.token) self.neutronclient = neutron.Client(NEUTRON_CLIENT_VERSION, endpoint_url=self.neutron_endpoint, token=self.token) self.cinderclient = cinder.Client(CINDER_CLIENT_VERSION, self.username, self.password, self.tenant, self.auth_url)
def switch_user(self, user, password, tenant): self.keystoneclient = keystone.Client(auth_url=self.auth_url, username=user, password=password, tenant_name=tenant) self.keystoneclient.authenticate() self.token = self.keystoneclient.auth_token self.novaclient = nova.Client(NOVA_CLIENT_VERSION, username=user, api_key=password, project_id=tenant, auth_url=self.auth_url) self.glanceclient = glance(GLANCE_CLIENT_VERSION, endpoint=self.image_endpoint, token=self.token) self.neutronclient = neutron.Client( NEUTRON_CLIENT_VERSION, endpoint_url=self.neutron_endpoint, token=self.token) self.cinderclient = cinder.Client(CINDER_CLIENT_VERSION, user, password, tenant, self.auth_url)
def switch_user(self, user, password, tenant): self.keystoneclient = keystone.Client(auth_url=self.auth_url, username=user, password=password, tenant_name=tenant) self.keystoneclient.authenticate() self.token = self.keystoneclient.auth_token self.novaclient = nova.Client(self.config.NOVA_CLIENT_VERSION, username=user, api_key=password, project_id=tenant, auth_url=self.auth_url) self.glanceclient = glance(self.config.GLANCE_CLIENT_VERSION, endpoint=self.image_endpoint, token=self.token) self.neutronclient = neutron.Client(self.config.NEUTRON_CLIENT_VERSION, endpoint_url=self.neutron_endpoint, token=self.token) self.cinderclient = cinder.Client(self.config.CINDER_CLIENT_VERSION, user, password, tenant, self.auth_url)
def __init__(self, config, cloud_prefix='SRC'): self.filtering_utils = FilteringUtils() self.config = config self.username = os.environ['%s_OS_USERNAME' % cloud_prefix] self.password = os.environ['%s_OS_PASSWORD' % cloud_prefix] self.tenant = os.environ['%s_OS_TENANT_NAME' % cloud_prefix] self.auth_url = os.environ['%s_OS_AUTH_URL' % cloud_prefix] self.image_endpoint = os.environ['%s_OS_IMAGE_ENDPOINT' % cloud_prefix] self.neutron_endpoint = os.environ['%s_OS_NEUTRON_ENDPOINT' % cloud_prefix] self.keystoneclient = keystone.Client(auth_url=self.auth_url, username=self.username, password=self.password, tenant_name=self.tenant) self.keystoneclient.authenticate() self.token = self.keystoneclient.auth_token self.novaclient = nova.Client(self.config.NOVA_CLIENT_VERSION, username=self.username, api_key=self.password, project_id=self.tenant, auth_url=self.auth_url) self.glanceclient = glance(self.config.GLANCE_CLIENT_VERSION, endpoint=self.image_endpoint, token=self.token) self.neutronclient = neutron.Client(self.config.NEUTRON_CLIENT_VERSION, endpoint_url=self.neutron_endpoint, token=self.token) self.cinderclient = cinder.Client(self.config.CINDER_CLIENT_VERSION, self.username, self.password, self.tenant, self.auth_url) # will be filled during create all networking step self.ext_net_id = None