Ejemplo n.º 1
0
def create_nova_client(user, service_type=None):
    """Creates a rich client for the Nova API using the test config."""
    if test_config.nova_client is None:
        raise SkipTest("No nova_client info specified in the Test Config "
                       "so this test will be skipped.")
    from novaclient.v2.client import Client
    if not service_type:
        service_type = test_config.nova_client['nova_service_type']
    openstack = Client(user.auth_user, user.auth_key,
                       user.tenant, test_config.nova_client['auth_url'],
                       service_type=service_type, no_cache=True)
    openstack.authenticate()
    return TestClient(openstack)
Ejemplo n.º 2
0
def create_nova_client(user, service_type=None):
    """Creates a rich client for the Nova API using the test config."""
    if test_config.nova_client is None:
        raise SkipTest("No nova_client info specified in the Test Config "
                       "so this test will be skipped.")
    from novaclient.v2.client import Client
    if not service_type:
        service_type = test_config.nova_client['nova_service_type']
    openstack = Client(user.auth_user,
                       user.auth_key,
                       user.tenant,
                       test_config.nova_client['auth_url'],
                       service_type=service_type,
                       no_cache=True)
    openstack.authenticate()
    return TestClient(openstack)
Ejemplo n.º 3
0
 def post_init(self):
     self.nt = Client(
         self.config.OS_USERNAME,
         self.config.OS_PASSWORD,
         self.config.OS_TENANT_NAME,
         self.config.OS_AUTH_URL,
         insecure=True,
     )
Ejemplo n.º 4
0
def nova_client(context):
    if CONF.nova_compute_url:
        url = '%(nova_url)s%(tenant)s' % {
            'nova_url': normalize_url(CONF.nova_compute_url),
            'tenant': context.tenant}
    else:
        url = get_endpoint(context.service_catalog,
                           service_type=CONF.nova_compute_service_type,
                           endpoint_region=CONF.os_region_name,
                           endpoint_type=CONF.nova_compute_endpoint_type)

    client = Client(context.user, context.auth_token,
                    bypass_url=url, project_id=context.tenant,
                    auth_url=PROXY_AUTH_URL)
    client.client.auth_token = context.auth_token
    client.client.management_url = url
    return client
Ejemplo n.º 5
0
#!/usr/bin/env python2.7

import paramiko
import os
import time
from neutronclient.v2_0 import client
from novaclient.v2.client import Client
from credentials import get_credentials
from credentials import get_nova_credentials

# After changing the weights we delete the old router
nova_credentials = get_nova_credentials()
nova_client = Client(**nova_credentials)
instance = nova_client.servers.find(name='Router2')
nova_client.servers.delete(instance)