self.__logger.info("Additional pre-configuration steps")
- self.util.set_credentials(self.snaps_creds.username,
- self.snaps_creds.password,
- self.snaps_creds.auth_url,
- self.snaps_creds.project_name)
+ self.util.set_credentials(self.snaps_creds)
# needs some images
self.__logger.info("Upload some OS images if it doesn't exist")
def test_vnf(self):
cfy_client = self.orchestrator['object']
- credentials = {"username": self.snaps_creds.username,
+ credentials = {"snaps_creds": self.snaps_creds,
+ "username": self.snaps_creds.username,
"password": self.snaps_creds.password,
"auth_url": self.snaps_creds.auth_url,
"tenant_name": self.snaps_creds.project_name}
self.test_cmd_map_yaml = yaml.safe_load(test_cmd_map_file)
test_cmd_map_file.close()
- self.util.set_credentials(credentials["username"],
- credentials["password"],
- credentials["auth_url"],
- credentials["tenant_name"])
+ self.util.set_credentials(credentials["snaps_creds"])
with open(self.util.test_env_config_yaml) as file_fd:
test_env_config_yaml = yaml.safe_load(file_fd)
from functest.utils.constants import CONST
from git import Repo
-from novaclient import client as novaclient
-from keystoneauth1.identity import v3
-from keystoneauth1 import session
from requests.auth import HTTPBasicAuth
+from snaps.openstack.utils import nova_utils
+
RESULT_SPRIT_INDEX = {
"transfer": 8,
logger = logging.getLogger(__name__)
def __init__(self):
- self.username = ""
- self.password = ""
- self.auth_url = ""
- self.tenant_name = ""
+ self.snaps_creds = ""
data_dir = data_dir = CONST.__getattribute__('dir_router_data')
self.logger.debug("removed %s" % self.test_result_json_file)
def get_nova_client(self):
- creds = self.get_nova_credentials()
- auth = v3.Password(auth_url=creds['auth_url'],
- username=creds['username'],
- password=creds['password'],
- project_name=creds['tenant_name'],
- user_domain_id='default',
- project_domain_id='default')
- sess = session.Session(auth=auth)
- nova_client = novaclient.Client(NOVA_CLIENT_API_VERSION, session=sess)
+ nova_client = nova_utils.nova_client(self.snaps_creds)
return nova_client
- def set_credentials(self, username, password, auth_url, tenant_name):
- self.username = username
- self.password = password
- self.auth_url = auth_url
- self.tenant_name = tenant_name
-
- def get_nova_credentials(self):
- creds = {}
- creds['username'] = self.username
- creds['password'] = self.password
- creds['auth_url'] = self.auth_url
- creds['tenant_name'] = self.tenant_name
- return creds
+ def set_credentials(self, snaps_creds):
+ self.snaps_creds = snaps_creds
def get_address(self, server_name, network_name):
nova_client = self.get_nova_client()
credentials = util_info["credentials"]
self.util = Utilvnf()
- self.util.set_credentials(credentials["username"],
- credentials["password"],
- credentials["auth_url"],
- credentials["tenant_name"])
+ self.util.set_credentials(credentials["snaps_creds"])
with open(self.util.test_env_config_yaml) as file_fd:
test_env_config_yaml = yaml.safe_load(file_fd)