diff options
Diffstat (limited to 'functest/opnfv_tests')
-rwxr-xr-x | functest/opnfv_tests/features/copper.py | 2 | ||||
-rwxr-xr-x | functest/opnfv_tests/openstack/healthcheck/healthcheck.sh | 5 | ||||
-rw-r--r-- | functest/opnfv_tests/openstack/tempest/conf_utils.py | 16 | ||||
-rwxr-xr-x | functest/opnfv_tests/sdn/odl/odl.py | 86 | ||||
-rwxr-xr-x | functest/opnfv_tests/sdn/onos/teston/onos.py | 16 |
5 files changed, 69 insertions, 56 deletions
diff --git a/functest/opnfv_tests/features/copper.py b/functest/opnfv_tests/features/copper.py index 8d5393c9..204fa337 100755 --- a/functest/opnfv_tests/features/copper.py +++ b/functest/opnfv_tests/features/copper.py @@ -22,4 +22,4 @@ class Copper(base.FeatureBase): super(Copper, self).__init__(project='copper', case='copper-notification', repo='dir_repo_copper') - self.cmd = "%s/tests/run.sh %s/tests" % (self.repo, self.repo) + self.cmd = 'cd %s/tests && ./run.sh' % self.repo diff --git a/functest/opnfv_tests/openstack/healthcheck/healthcheck.sh b/functest/opnfv_tests/openstack/healthcheck/healthcheck.sh index e27cf4b4..57aa0c70 100755 --- a/functest/opnfv_tests/openstack/healthcheck/healthcheck.sh +++ b/functest/opnfv_tests/openstack/healthcheck/healthcheck.sh @@ -228,10 +228,11 @@ sleep ${wait_time} # Check if flavor exists -if [[ -z $(nova flavor-list|grep $flavor) ]]; then +if [[ -z $(openstack flavor list -f value -c Name | fgrep -x $flavor) ]]; then # if given flavor doesn't exist, we create one debug "Flavor $flavor doesn't exist. Creating a new flavor." - nova flavor-create --is-public false ${flavor} auto 512 1 1 --is-public True + openstack flavor create ${flavor} --id auto --ram 512 --disk 1 --vcpus 1 + openstack flavor set ${flavor} --property hw:mem_page_size=any fi debug "Using flavor $flavor to boot the instances." diff --git a/functest/opnfv_tests/openstack/tempest/conf_utils.py b/functest/opnfv_tests/openstack/tempest/conf_utils.py index 5295ff37..6aa39ea9 100644 --- a/functest/opnfv_tests/openstack/tempest/conf_utils.py +++ b/functest/opnfv_tests/openstack/tempest/conf_utils.py @@ -15,6 +15,7 @@ import shutil import opnfv.utils.constants as releng_constants import functest.utils.functest_utils as ft_utils +import functest.utils.openstack_utils as os_utils from functest.utils.constants import CONST IMAGE_ID_ALT = None @@ -129,9 +130,11 @@ def configure_tempest_multisite(logger, deployment_dir): config.read(tempest_conf_file) config.set('service_available', 'kingbird', 'true') - cmd = ("openstack endpoint show kingbird | grep publicurl |" - "awk '{print $4}' | awk -F '/' '{print $4}'") - kingbird_api_version = os.popen(cmd).read() + # cmd = ("openstack endpoint show kingbird | grep publicurl |" + # "awk '{print $4}' | awk -F '/' '{print $4}'") + # kingbird_api_version = os.popen(cmd).read() + kingbird_api_version = os_utils.get_endpoint(service_type='kingbird') + if CI_INSTALLER_TYPE == 'fuel': # For MOS based setup, the service is accessible # via bind host @@ -172,9 +175,10 @@ def configure_tempest_multisite(logger, deployment_dir): bind_details)[0] kingbird_endpoint_url = "http://%s:%s/" % (bind_host, bind_port) else: - cmd = "openstack endpoint show kingbird | grep publicurl |\ - awk '{print $4}' | awk -F '/' '{print $3}'" - kingbird_endpoint_url = os.popen(cmd).read() + # cmd = "openstack endpoint show kingbird | grep publicurl |\ + # awk '{print $4}' | awk -F '/' '{print $3}'" + # kingbird_endpoint_url = os.popen(cmd).read() + kingbird_endpoint_url = os_utils.get_endpoint(service_type='kingbird') try: config.add_section("kingbird") diff --git a/functest/opnfv_tests/sdn/odl/odl.py b/functest/opnfv_tests/sdn/odl/odl.py index 0905e55c..45b313d5 100755 --- a/functest/opnfv_tests/sdn/odl/odl.py +++ b/functest/opnfv_tests/sdn/odl/odl.py @@ -15,7 +15,7 @@ import re import sys import urlparse -from robot.api import ExecutionResult, ResultVisitor +import robot.api from robot.errors import RobotError import robot.run from robot.utils.robottime import timestamp_to_secs @@ -25,7 +25,7 @@ import functest.utils.functest_logger as ft_logger import functest.utils.openstack_utils as op_utils -class ODLResultVisitor(ResultVisitor): +class ODLResultVisitor(robot.api.ResultVisitor): def __init__(self): self._data = [] @@ -79,7 +79,7 @@ class ODLTests(testcase_base.TestcaseBase): def parse_results(self): xml_file = os.path.join(self.res_dir, 'output.xml') - result = ExecutionResult(xml_file) + result = robot.api.ExecutionResult(xml_file) visitor = ODLResultVisitor() result.visit(visitor) self.criteria = result.suite.status @@ -180,44 +180,52 @@ class ODLTests(testcase_base.TestcaseBase): return self.main(**kwargs) +class ODLParser(): + + def __init__(self): + self.parser = argparse.ArgumentParser() + self.parser.add_argument( + '-k', '--keystoneip', help='Keystone IP', + default='127.0.0.1') + self.parser.add_argument( + '-n', '--neutronip', help='Neutron IP', + default='127.0.0.1') + self.parser.add_argument( + '-a', '--osusername', help='Username for OpenStack', + default='admin') + self.parser.add_argument( + '-b', '--ostenantname', help='Tenantname for OpenStack', + default='admin') + self.parser.add_argument( + '-c', '--ospassword', help='Password for OpenStack', + default='admin') + self.parser.add_argument( + '-o', '--odlip', help='OpenDaylight IP', + default='127.0.0.1') + self.parser.add_argument( + '-w', '--odlwebport', help='OpenDaylight Web Portal Port', + default='8080') + self.parser.add_argument( + '-r', '--odlrestconfport', help='OpenDaylight RESTConf Port', + default='8181') + self.parser.add_argument( + '-d', '--odlusername', help='Username for ODL', + default='admin') + self.parser.add_argument( + '-e', '--odlpassword', help='Password for ODL', + default='admin') + self.parser.add_argument( + '-p', '--pushtodb', help='Push results to DB', + action='store_true') + + def parse_args(self, argv=[]): + return vars(self.parser.parse_args(argv)) + + if __name__ == '__main__': - parser = argparse.ArgumentParser() - parser.add_argument('-k', '--keystoneip', - help='Keystone IP', - default='127.0.0.1') - parser.add_argument('-n', '--neutronip', - help='Neutron IP', - default='127.0.0.1') - parser.add_argument('-a', '--osusername', - help='Username for OpenStack', - default='admin') - parser.add_argument('-b', '--ostenantname', - help='Tenantname for OpenStack', - default='admin') - parser.add_argument('-c', '--ospassword', - help='Password for OpenStack', - default='admin') - parser.add_argument('-o', '--odlip', - help='OpenDaylight IP', - default='127.0.0.1') - parser.add_argument('-w', '--odlwebport', - help='OpenDaylight Web Portal Port', - default='8080') - parser.add_argument('-r', '--odlrestconfport', - help='OpenDaylight RESTConf Port', - default='8181') - parser.add_argument('-d', '--odlusername', - help='Username for ODL', - default='admin') - parser.add_argument('-e', '--odlpassword', - help='Password for ODL', - default='admin') - parser.add_argument('-p', '--pushtodb', - help='Push results to DB', - action='store_true') - - args = vars(parser.parse_args()) odl = ODLTests() + parser = ODLParser() + args = parser.parse_args(sys.argv[1:]) try: result = odl.main(**args) if result != testcase_base.TestcaseBase.EX_OK: diff --git a/functest/opnfv_tests/sdn/onos/teston/onos.py b/functest/opnfv_tests/sdn/onos/teston/onos.py index 300f56d1..213bdb7d 100755 --- a/functest/opnfv_tests/sdn/onos/teston/onos.py +++ b/functest/opnfv_tests/sdn/onos/teston/onos.py @@ -18,14 +18,15 @@ import datetime import os import re import time +import urlparse import argparse from neutronclient.v2_0 import client as neutronclient +import functest.utils.functest_constants as ft_constants import functest.utils.functest_logger as ft_logger import functest.utils.functest_utils as ft_utils import functest.utils.openstack_utils as openstack_utils -import functest.utils.functest_constants as ft_constants parser = argparse.ArgumentParser() @@ -135,9 +136,9 @@ def GetResult(): def SetOnosIp(): - cmd = "openstack catalog show network | grep publicURL" - cmd_output = os.popen(cmd).read() - OC1 = re.search(r"\d+\.\d+\.\d+\.\d+", cmd_output).group() + # cmd = "openstack catalog show network | grep publicURL" + neutron_url = openstack_utils.get_endpoint(service_type='network') + OC1 = urlparse.urlparse(neutron_url).hostname os.environ['OC1'] = OC1 time.sleep(2) logger.debug("ONOS IP is " + OC1) @@ -180,10 +181,9 @@ def SfcTest(): def GetIp(type): - cmd = "openstack catalog show " + type + " | grep publicURL" - cmd_output = os.popen(cmd).read() - ip = re.search(r"\d+\.\d+\.\d+\.\d+", cmd_output).group() - return ip + # cmd = "openstack catalog show " + type + " | grep publicURL" + url = openstack_utils.get_endpoint(service_type=type) + return urlparse.urlparse(url).hostname def Replace(before, after): |