diff options
Diffstat (limited to 'functest/opnfv_tests')
6 files changed, 23 insertions, 48 deletions
diff --git a/functest/opnfv_tests/vnf/epc/juju_epc.py b/functest/opnfv_tests/vnf/epc/juju_epc.py index 8e2bca22..d9c14219 100644 --- a/functest/opnfv_tests/vnf/epc/juju_epc.py +++ b/functest/opnfv_tests/vnf/epc/juju_epc.py @@ -150,6 +150,11 @@ class JujuEpc(vnf.VnfOnBoarding): self.created_object.append(image_creator) def deploy_orchestrator(self): + """ + Create network, subnet, router + + Bootstrap juju + """ self.__logger.info("Deployed Orchestrator") private_net_name = CONST.__getattribute__( 'vnf_{}_private_net_name'.format(self.case_name)) @@ -224,6 +229,7 @@ class JujuEpc(vnf.VnfOnBoarding): self.__logger.info("Credential information : %s", net_id) juju_bootstrap_command = ('juju bootstrap abot-epc abot-controller ' '--config network={} --metadata-source ~ ' + '--config ssl-hostname-verification=false ' '--constraints mem=2G --bootstrap-series ' 'trusty ' '--config use-floating-ip=true --debug'. @@ -286,6 +292,7 @@ class JujuEpc(vnf.VnfOnBoarding): return False def test_vnf(self): + """Run test on ABoT.""" start_time = time.time() self.__logger.info("Running VNF Test cases....") os.system('juju run-action abot-epc-basic/0 run ' @@ -312,6 +319,7 @@ class JujuEpc(vnf.VnfOnBoarding): return True def clean(self): + """Clean created objects/functions.""" try: if not self.orchestrator['requirements']['preserve_setup']: self.__logger.info("Removing deployment files...") @@ -324,7 +332,7 @@ class JujuEpc(vnf.VnfOnBoarding): self.__logger.info("Destroying Orchestrator...") os.system('juju destroy-controller -y abot-controller ' '--destroy-all-models') - except: + except Exception: # pylint: disable=broad-except self.__logger.warn("Some issue during the undeployment ..") self.__logger.warn("Tenant clean continue ..") @@ -333,12 +341,10 @@ class JujuEpc(vnf.VnfOnBoarding): for creator in reversed(self.created_object): try: creator.clean() - except Exception as exc: + except Exception as exc: # pylint: disable=broad-except self.__logger.error('Unexpected error cleaning - %s', exc) self.__logger.info("Releasing all the floating IPs") - # user_id = os_utils.get_user_id(self.keystone_client, - # self.tenant_name) floating_ips = os_utils.get_floating_ips(self.neutron_client) tenant_id = os_utils.get_tenant_id(self.keystone_client, self.tenant_name) diff --git a/functest/opnfv_tests/vnf/epc/juju_epc.yaml b/functest/opnfv_tests/vnf/epc/juju_epc.yaml index 33eeb211..67f3224f 100644 --- a/functest/opnfv_tests/vnf/epc/juju_epc.yaml +++ b/functest/opnfv_tests/vnf/epc/juju_epc.yaml @@ -11,7 +11,7 @@ orchestrator: requirements: dep_package: 'software-properties-common' flavor: - name: m1.small + name: m1.small.juju ram_min: 2048 preserve_setup: false vnf: @@ -24,7 +24,7 @@ vnf: version: '1' requirements: flavor: - name: m1.medium + name: m1.medium.juju ram_min: 4096 vnf_test_suite: name: abot-epc-basic diff --git a/functest/opnfv_tests/vnf/router/cloudify_vrouter.py b/functest/opnfv_tests/vnf/router/cloudify_vrouter.py index 788a9413..f2cd63fb 100644 --- a/functest/opnfv_tests/vnf/router/cloudify_vrouter.py +++ b/functest/opnfv_tests/vnf/router/cloudify_vrouter.py @@ -112,10 +112,7 @@ class CloudifyVrouter(vrouter_base.VrouterOnBoardingBase): 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") @@ -370,7 +367,8 @@ class CloudifyVrouter(vrouter_base.VrouterOnBoardingBase): 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} diff --git a/functest/opnfv_tests/vnf/router/test_controller/function_test_exec.py b/functest/opnfv_tests/vnf/router/test_controller/function_test_exec.py index 9303aeca..d023d479 100644 --- a/functest/opnfv_tests/vnf/router/test_controller/function_test_exec.py +++ b/functest/opnfv_tests/vnf/router/test_controller/function_test_exec.py @@ -37,10 +37,7 @@ class FunctionTestExec(object): 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) diff --git a/functest/opnfv_tests/vnf/router/utilvnf.py b/functest/opnfv_tests/vnf/router/utilvnf.py index c31d6777..9d196836 100644 --- a/functest/opnfv_tests/vnf/router/utilvnf.py +++ b/functest/opnfv_tests/vnf/router/utilvnf.py @@ -18,10 +18,9 @@ import yaml 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, @@ -53,10 +52,7 @@ class Utilvnf(object): 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') @@ -114,31 +110,12 @@ class Utilvnf(object): 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() diff --git a/functest/opnfv_tests/vnf/router/vnf_controller/vm_controller.py b/functest/opnfv_tests/vnf/router/vnf_controller/vm_controller.py index 50487d1c..d1c2e324 100644 --- a/functest/opnfv_tests/vnf/router/vnf_controller/vm_controller.py +++ b/functest/opnfv_tests/vnf/router/vnf_controller/vm_controller.py @@ -32,10 +32,7 @@ class VmController(object): 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) |