Select python 3.6 as default 71/68471/3
authorCédric Ollivier <cedric.ollivier@orange.com>
Thu, 12 Sep 2019 08:22:49 +0000 (10:22 +0200)
committerCédric Ollivier <cedric.ollivier@orange.com>
Sat, 14 Sep 2019 08:24:17 +0000 (10:24 +0200)
It switches to Python3 as default due to new OPNFV iruya release
date (December) which is very closed to Python2 EOL.

Functest Iruya (first release published in April) has supported
both Python2 and Python3.

Change-Id: I4c1294a5361e591fc7a8a88b3d067fc3b39e00c4
Signed-off-by: Cédric Ollivier <cedric.ollivier@orange.com>
29 files changed:
docker/benchmarking/Dockerfile
docker/core/Dockerfile
docker/healthcheck/Dockerfile
docker/smoke/Dockerfile
docker/tempest/Dockerfile
docker/vnf/Dockerfile
functest/core/cloudify.py
functest/core/singlevm.py
functest/core/tenantnetwork.py
functest/opnfv_tests/openstack/rally/rally.py
functest/opnfv_tests/openstack/vping/vping_userdata.py
functest/opnfv_tests/sdn/odl/odl.py
functest/opnfv_tests/vnf/epc/juju_epc.py
functest/opnfv_tests/vnf/ims/clearwater.py
functest/opnfv_tests/vnf/ims/cloudify_ims.py
functest/opnfv_tests/vnf/ims/heat_ims.py
functest/opnfv_tests/vnf/router/cloudify_vrouter.py
functest/opnfv_tests/vnf/router/test_controller/function_test_exec.py
functest/opnfv_tests/vnf/router/utilvnf.py
functest/opnfv_tests/vnf/router/vnf_controller/checker.py
functest/opnfv_tests/vnf/router/vnf_controller/command_generator.py
functest/opnfv_tests/vnf/router/vnf_controller/ssh_client.py
functest/opnfv_tests/vnf/router/vnf_controller/vm_controller.py
functest/opnfv_tests/vnf/router/vnf_controller/vnf_controller.py
functest/opnfv_tests/vnf/router/vrouter_base.py
functest/tests/unit/utils/test_functest_utils.py
functest/utils/config.py
tox.ini
upper-constraints.txt

index 67bb219..6eb1e46 100644 (file)
@@ -3,24 +3,24 @@ FROM opnfv/functest-tempest:iruya
 ARG BRANCH=stable/iruya
 ARG OPENSTACK_TAG=stable/stein
 ARG TEMPEST_TAG=21.0.0
-ARG VMTP_TAG=2.5.0
+ARG VMTP_TAG=dc79be8a3b566507e1907a70fc9eaf0f1d6c9e9c
 
 RUN apk --no-cache add --update libxml2 libxslt && \
     apk --no-cache add --virtual .build-deps --update \
-        python-dev build-base linux-headers libffi-dev \
+        python3-dev build-base linux-headers libffi-dev \
         openssl-dev libjpeg-turbo-dev libxml2-dev libxslt-dev && \
     wget -q -O- https://opendev.org/openstack/requirements/raw/branch/$OPENSTACK_TAG/upper-constraints.txt > upper-constraints.txt && \
     sed -i -E s/^tempest==+.*$/-e\ git+https:\\/\\/opendev.org\\/openstack\\/tempest@$TEMPEST_TAG#egg=tempest/ upper-constraints.txt && \
     case $(uname -m) in aarch*|arm*) sed -i -E /^PyNaCl=/d upper-constraints.txt ;; esac && \
     wget -q -O- https://git.opnfv.org/functest/plain/upper-constraints.txt?h=$BRANCH > upper-constraints.opnfv.txt && \
     sed -i -E /#egg=functest/d upper-constraints.opnfv.txt && \
-    case $(uname -m) in aarch*|arm*) CFLAGS="-O0" pip install --no-cache-dir -cupper-constraints.txt -cupper-constraints.opnfv.txt lxml ;; esac && \
+    case $(uname -m) in aarch*|arm*) CFLAGS="-O0" pip3 install --no-cache-dir -cupper-constraints.txt -cupper-constraints.opnfv.txt lxml ;; esac && \
     git init /src/vmtp && \
     (cd /src/vmtp && \
         git fetch --tags https://opendev.org/x/vmtp.git $VMTP_TAG && \
         git checkout FETCH_HEAD) && \
     update-requirements -s --source /src/openstack-requirements /src/vmtp/ && \
-    pip install --no-cache-dir --src /src -cupper-constraints.txt -cupper-constraints.opnfv.txt \
+    pip3 install --no-cache-dir --src /src -cupper-constraints.txt -cupper-constraints.opnfv.txt \
         /src/vmtp && \
     mkdir -p /home/opnfv/functest/data/rally/neutron && \
     git init /src/neutron && \
@@ -30,5 +30,5 @@ RUN apk --no-cache add --update libxml2 libxslt && \
     cp -r /src/neutron/rally-jobs /home/opnfv/functest/data/rally/neutron/rally-jobs && \
     rm -r upper-constraints.txt upper-constraints.opnfv.txt /src/vmtp /src/neutron && \
     apk del .build-deps
-COPY testcases.yaml /usr/lib/python2.7/site-packages/xtesting/ci/testcases.yaml
+COPY testcases.yaml /usr/lib/python3.6/site-packages/xtesting/ci/testcases.yaml
 CMD ["run_tests", "-t", "all"]
index c60fb9e..9903ce2 100644 (file)
@@ -4,28 +4,29 @@ ARG BRANCH=stable/iruya
 ARG OPENSTACK_TAG=stable/stein
 
 RUN apk --no-cache add --update \
-        python libffi openssl libjpeg-turbo py-pip bash \
+        python3 libffi openssl libjpeg-turbo py3-pip bash \
         grep sed wget ca-certificates git openssh-client qemu-img iputils && \
     apk --no-cache add --virtual .build-deps --update \
-        python-dev build-base linux-headers libffi-dev \
+        python3-dev build-base linux-headers libffi-dev \
         openssl-dev libjpeg-turbo-dev && \
     wget -q -O- https://opendev.org/openstack/requirements/raw/branch/$OPENSTACK_TAG/upper-constraints.txt > upper-constraints.txt && \
-    case $(uname -m) in aarch*|arm*) sed -i -E /^PyNaCl=/d upper-constraints.txt && apk add --no-cache py-pynacl ;; esac && \
+    case $(uname -m) in aarch*|arm*) sed -i -E /^PyNaCl=/d upper-constraints.txt && apk add --no-cache py3-pynacl ;; esac && \
     wget -q -O- https://git.opnfv.org/functest/plain/upper-constraints.txt?h=$BRANCH > upper-constraints.opnfv.txt  && \
     sed -i -E /#egg=functest/d upper-constraints.opnfv.txt && \
-    pip install --no-cache-dir --src /src -cupper-constraints.opnfv.txt -cupper-constraints.txt \
+    pip3 install --no-cache-dir --src /src -cupper-constraints.opnfv.txt -cupper-constraints.txt \
         -e git+https://opendev.org/openstack/requirements@$OPENSTACK_TAG#egg=openstack_requirements && \
     git init /src/functest && \
     (cd /src/functest && \
         git fetch --tags https://gerrit.opnfv.org/gerrit/functest $BRANCH && \
         git checkout FETCH_HEAD) && \
     update-requirements -s --source /src/openstack-requirements /src/functest && \
-    pip install --no-cache-dir --src /src -cupper-constraints.opnfv.txt -cupper-constraints.txt \
+    pip3 install --no-cache-dir --src /src -cupper-constraints.opnfv.txt -cupper-constraints.txt \
         /src/functest && \
     rm -r upper-constraints.txt upper-constraints.opnfv.txt /src/functest && \
-    cp /usr/lib/python2.7/site-packages/functest/ci/logging.ini /usr/lib/python2.7/site-packages/xtesting/ci/ && \
-    cp /usr/lib/python2.7/site-packages/functest/ci/logging.debug.ini /usr/lib/python2.7/site-packages/xtesting/ci/ && \
+    cp /usr/lib/python3.6/site-packages/functest/ci/logging.ini /usr/lib/python3.6/site-packages/xtesting/ci/ && \
+    cp /usr/lib/python3.6/site-packages/functest/ci/logging.debug.ini /usr/lib/python3.6/site-packages/xtesting/ci/ && \
     bash -c "mkdir -p /var/lib/xtesting /home/opnfv" && \
     ln -s /var/lib/xtesting /home/opnfv/functest && \
     bash -c "mkdir -p /home/opnfv/functest{/conf,/data,/images,/results} /home/opnfv/repos/vnfs" && \
+    ln -s /usr/bin/python3 /usr/bin/python && \
     apk del .build-deps
index 06a83ed..a416683 100644 (file)
@@ -7,13 +7,13 @@ ARG ODL_TAG=85448c9d97b89989488e675b29b38ac42d8674e4
 
 COPY thirdparty-requirements.txt thirdparty-requirements.txt
 RUN apk --no-cache add --virtual .build-deps --update \
-        python-dev build-base linux-headers libffi-dev openssl-dev && \
+        python3-dev build-base linux-headers libffi-dev openssl-dev && \
     wget -q -O- https://opendev.org/openstack/requirements/raw/branch/$OPENSTACK_TAG/upper-constraints.txt > upper-constraints.txt && \
     sed -i -E s/^tempest==+.*$/-e\ git+https:\\/\\/opendev.org\\/openstack\\/tempest@$TEMPEST_TAG#egg=tempest/ upper-constraints.txt && \
     case $(uname -m) in aarch*|arm*) sed -i -E /^PyNaCl=/d upper-constraints.txt ;; esac && \
     wget -q -O- https://git.opnfv.org/functest/plain/upper-constraints.txt?h=$BRANCH > upper-constraints.opnfv.txt && \
     sed -i -E /#egg=functest/d upper-constraints.opnfv.txt && \
-    pip install --no-cache-dir --src /src -cupper-constraints.txt -cupper-constraints.opnfv.txt \
+    pip3 install --no-cache-dir --src /src -cupper-constraints.txt -cupper-constraints.opnfv.txt \
         -rthirdparty-requirements.txt && \
     git init /src/odl_test && \
     (cd /src/odl_test && \
@@ -22,5 +22,5 @@ RUN apk --no-cache add --virtual .build-deps --update \
     rm -r /src/odl_test/.git thirdparty-requirements.txt upper-constraints.txt \
         upper-constraints.opnfv.txt && \
     apk del .build-deps
-COPY testcases.yaml /usr/lib/python2.7/site-packages/xtesting/ci/testcases.yaml
+COPY testcases.yaml /usr/lib/python3.6/site-packages/xtesting/ci/testcases.yaml
 CMD ["run_tests", "-t", "all"]
index 6ea0565..408eeab 100644 (file)
@@ -9,7 +9,7 @@ ARG NEUTRON_TEMPEST_TAG=0.3.0
 ARG BARBICAN_TAG=0.1.0
 
 RUN apk --no-cache add --virtual .build-deps --update \
-        python-dev build-base linux-headers libffi-dev \
+        python3-dev build-base linux-headers libffi-dev \
         openssl-dev libjpeg-turbo-dev libxml2-dev libxslt-dev && \
     wget -q -O- https://opendev.org/openstack/requirements/raw/branch/$OPENSTACK_TAG/upper-constraints.txt > upper-constraints.txt && \
     sed -i -E s/^tempest==+.*$/-e\ git+https:\\/\\/opendev.org\\/openstack\\/tempest@$TEMPEST_TAG#egg=tempest/ upper-constraints.txt && \
@@ -31,14 +31,14 @@ RUN apk --no-cache add --virtual .build-deps --update \
         git fetch --tags https://opendev.org/openstack/barbican-tempest-plugin.git $BARBICAN_TAG && \
         git checkout FETCH_HEAD) && \
     update-requirements -s --source /src/openstack-requirements /src/barbican-tempest-plugin/ && \
-    pip install --no-cache-dir --src /src -cupper-constraints.txt -cupper-constraints.opnfv.txt \
+    pip3 install --no-cache-dir --src /src -cupper-constraints.txt -cupper-constraints.opnfv.txt \
         /src/patrole /src/barbican-tempest-plugin /src/neutron-tempest-plugin \
         networking-bgpvpn networking-sfc && \
     mkdir -p /home/opnfv/functest/data/refstack && \
     mkdir -p /etc/neutron /etc/cinder /etc/glance /etc/keystone /etc/nova && \
     wget -q -O /etc/glance/policy.json https://opendev.org/openstack/glance/raw/branch/$OPENSTACK_TAG/etc/policy.json && \
     virtualenv --no-pip --no-setuptools --no-wheel oslo && . oslo/bin/activate && \
-    pip install --no-cache-dir --src /src -cupper-constraints.txt -cupper-constraints.opnfv.txt \
+    pip3 install --no-cache-dir --src /src -cupper-constraints.txt -cupper-constraints.opnfv.txt \
         oslo.policy neutron && \
     oslopolicy-sample-generator  --format json --output-file /etc/neutron/policy.json --namespace neutron && \
     deactivate && \
@@ -48,5 +48,5 @@ RUN apk --no-cache add --virtual .build-deps --update \
 COPY compute.txt /home/opnfv/functest/data/refstack/compute.txt
 COPY object.txt /home/opnfv/functest/data/refstack/object.txt
 COPY platform.txt /home/opnfv/functest/data/refstack/platform.txt
-COPY testcases.yaml /usr/lib/python2.7/site-packages/xtesting/ci/testcases.yaml
+COPY testcases.yaml /usr/lib/python3.6/site-packages/xtesting/ci/testcases.yaml
 CMD ["run_tests", "-t", "all"]
index 2835285..4327507 100644 (file)
@@ -8,7 +8,7 @@ ARG RALLY_OPENSTACK_TAG=1.5.0
 ARG UJSON_TAG=d25e024f481c5571d15f3c0c406a498ca0467cfd
 
 RUN apk --no-cache add --virtual .build-deps --update \
-        python-dev build-base linux-headers libffi-dev \
+        python3-dev build-base linux-headers libffi-dev \
         openssl-dev libjpeg-turbo-dev && \
     wget -q -O- https://opendev.org/openstack/requirements/raw/branch/$OPENSTACK_TAG/upper-constraints.txt > upper-constraints.txt && \
     sed -i -E s/^tempest==+.*$/-e\ git+https:\\/\\/opendev.org\\/openstack\\/tempest@$TEMPEST_TAG#egg=tempest/ upper-constraints.txt && \
@@ -24,9 +24,9 @@ RUN apk --no-cache add --virtual .build-deps --update \
     (git clone https://opendev.org/openstack/rally-openstack.git /src/rally-openstack && \
         cd /src/rally-openstack && git checkout $RALLY_OPENSTACK_TAG) && \
     update-requirements -s --source /src/openstack-requirements /src/rally-openstack && \
-    pip install --no-cache-dir --src /src -cupper-constraints.txt -cupper-constraints.opnfv.txt \
+    pip3 install --no-cache-dir --src /src -cupper-constraints.txt -cupper-constraints.opnfv.txt \
         tempest /src/rally-openstack && \
-    pip install --no-cache-dir --src /src -cupper-constraints.txt -cupper-constraints.opnfv.txt \
+    pip3 install --no-cache-dir --src /src -cupper-constraints.txt -cupper-constraints.opnfv.txt \
         /src/rally && \
     rm -r upper-constraints.txt upper-constraints.opnfv.txt /src/rally /src/rally-openstack && \
     mkdir -p /etc/rally && \
index 200bced..835890e 100644 (file)
@@ -21,7 +21,7 @@ ENV PATH $GOBIN:$PATH
 COPY clearwater-heat-singlenet-deps.patch /tmp/clearwater-heat-singlenet-deps.patch
 RUN apk --no-cache add --update \
         ruby ruby-bundler ruby-irb ruby-rdoc \
-        procps libxslt libxml2 zlib libffi python3 go musl-dev && \
+        procps libxslt libxml2 zlib libffi go musl-dev && \
     apk --no-cache add --virtual .build-deps --update \
         ruby-dev g++ make libxslt-dev libxml2-dev zlib-dev libffi-dev g++ make && \
     wget -q -O- https://opendev.org/openstack/requirements/raw/branch/$OPENSTACK_TAG/upper-constraints.txt > upper-constraints.txt && \
@@ -64,7 +64,7 @@ RUN apk --no-cache add --update \
         (cd /src/epc-requirements/abot_charm && \
             git fetch --tags https://github.com/RebacaInc/abot_charm.git $ABOT_CHARM && \
             git checkout FETCH_HEAD) && \
-        python3 -m pip install --no-cache-dir --src /src -cupper-constraints.txt -cupper-constraints.opnfv.txt \
+        pip3 install --no-cache-dir --src /src -cupper-constraints.txt -cupper-constraints.opnfv.txt \
             juju-wait==$JUJU_WAIT_TAG && \
         go get -d github.com/rogpeppe/godeps && \
         (cd $GOPATH/src/github.com/rogpeppe/godeps && git checkout $GODEPS_TAG && go install -v github.com/rogpeppe/godeps) && \
@@ -78,5 +78,5 @@ RUN apk --no-cache add --update \
         /src/vims-test/build-infra/.git /src/opnfv-vnf-vyos-blueprint/.git \
         /tmp/clearwater-heat-singlenet-deps.patch && \
     apk del .build-deps
-COPY testcases.yaml /usr/lib/python2.7/site-packages/xtesting/ci/testcases.yaml
+COPY testcases.yaml /usr/lib/python3.6/site-packages/xtesting/ci/testcases.yaml
 CMD ["run_tests", "-t", "all"]
index 21bfc93..b5bd1b3 100644 (file)
@@ -147,7 +147,7 @@ class Cloudify(singlevm.SingleVm2):
                         self.cfy_client.executions.cancel(
                             execution['id'], force=True)
                     except Exception:  # pylint: disable=broad-except
-                        self.__logger.warn("Can't cancel the current exec")
+                        self.__logger.warning("Can't cancel the current exec")
             execution = self.cfy_client.executions.start(
                 dep_name, 'uninstall', parameters=dict(ignore_failure=True))
             wait_for_execution(self.cfy_client, execution, self.__logger)
@@ -191,9 +191,8 @@ def wait_for_execution(client, execution, logger, timeout=3600, ):
                     'execution of operation {0} for deployment {1} '
                     'timed out'.format(execution.workflow_id,
                                        execution.deployment_id))
-            else:
-                # update the remaining timeout
-                timeout = deadline - time.time()
+            # update the remaining timeout
+            timeout = deadline - time.time()
 
         if not execution_ended:
             execution = client.executions.get(execution.id)
index 1da30de..0473a21 100644 (file)
@@ -230,11 +230,10 @@ class VmReady1(tenantnetwork.TenantNetwork1):
                 self.__logger.debug(
                     "regex found: '%s' in console\n%s", regex, console)
                 return True
-            else:
-                self.__logger.debug(
-                    "try %s: cannot find regex '%s' in console\n%s",
-                    iloop + 1, regex, console)
-                time.sleep(10)
+            self.__logger.debug(
+                "try %s: cannot find regex '%s' in console\n%s",
+                iloop + 1, regex, console)
+            time.sleep(10)
         self.__logger.error("cannot find regex '%s' in console", regex)
         return False
 
index ae739ac..604e49a 100644 (file)
@@ -33,7 +33,7 @@ from functest.utils import config
 from functest.utils import env
 
 
-class NewProject(object):
+class NewProject():
     """Ease creating new projects/users"""
     # pylint: disable=too-many-instance-attributes
 
index 8100eda..9a04f38 100644 (file)
@@ -22,7 +22,6 @@ import shutil
 import subprocess
 import time
 
-from threading import Timer
 import pkg_resources
 import prettytable
 from ruamel.yaml import YAML
@@ -101,7 +100,6 @@ class RallyBase(singlevm.VmReady2):
         self.run_cmd = ''
         self.network_extensions = []
         self.services = []
-        self.task_aborted = False
 
     def build_task_args(self, test_name):
         """Build arguments for the Rally task."""
@@ -425,25 +423,19 @@ class RallyBase(singlevm.VmReady2):
         else:
             LOGGER.info('Test scenario: "%s" Failed.', test_name)
 
-    def kill_task(self, proc):
-        """ Kill a task."""
-        proc.kill()
-        self.task_aborted = True
-
     def run_task(self, test_name):
         """Run a task."""
         LOGGER.info('Starting test scenario "%s" ...', test_name)
         LOGGER.debug('running command: %s', self.run_cmd)
         proc = subprocess.Popen(self.run_cmd, stdout=subprocess.PIPE,
                                 stderr=subprocess.STDOUT)
-        self.task_aborted = False
-        timer = Timer(self.task_timeout, self.kill_task, [proc])
-        timer.start()
-        output = proc.communicate()[0]
-        if self.task_aborted:
-            LOGGER.error("Failed to complete task")
-            raise Exception("Failed to complete task")
-        timer.cancel()
+        try:
+            output = proc.communicate(timeout=self.task_timeout)[0]
+        except subprocess.TimeoutExpired:
+            proc.kill()
+            proc.communicate()
+            LOGGER.error("Failed to complete run task")
+            raise Exception("Failed to complete run task")
         task_id = self.get_task_id(output)
         LOGGER.debug('task_id : %s', task_id)
         if task_id is None:
index a58184c..225c167 100644 (file)
@@ -88,7 +88,7 @@ class VPingUserdata(singlevm.VmReady2):
             elif sec % 10 == 0:
                 if "request failed" in p_console:
                     self.logger.debug(
-                        "It seems userdata is not supported in nova boot. " +
+                        "It seems userdata is not supported in nova boot. "
                         "Waiting a bit...")
                     tries += 1
                 else:
index 17600a3..b54f0f5 100644 (file)
@@ -189,7 +189,7 @@ class ODLTests(robotframework.RobotFramework):
         return self.run_suites(suites, **kwargs)
 
 
-class ODLParser(object):  # pylint: disable=too-few-public-methods
+class ODLParser():  # pylint: disable=too-few-public-methods
     """Parser to run ODL test suites."""
 
     def __init__(self):
index 7c8a925..5a0a86b 100644 (file)
@@ -148,13 +148,13 @@ class JujuEpc(singlevm.VmReady2):
 
     def check_requirements(self):
         if not os.path.exists("/src/epc-requirements/go/bin/juju"):
-            self.__logger.warn(
+            self.__logger.warning(
                 "Juju cannot be cross-compiled (arm and arm64) from the time "
                 "being")
             self.is_skipped = True
             self.project.clean()
         if env.get('NEW_USER_ROLE').lower() == "admin":
-            self.__logger.warn(
+            self.__logger.warning(
                 "Defining NEW_USER_ROLE=admin will easily break the testcase "
                 "because Juju doesn't manage tenancy (e.g. subnet  "
                 "overlapping)")
index 64f0428..67128b1 100644 (file)
@@ -24,7 +24,7 @@ __author__ = ("Valentin Boucher <valentin.boucher@orange.com>, "
               "Helen Yao <helanyao@gmail.com>")
 
 
-class ClearwaterTesting(object):
+class ClearwaterTesting():
     """vIMS clearwater base usable by several orchestrators"""
 
     def __init__(self, case_name, bono_ip, ellis_ip):
@@ -91,8 +91,7 @@ class ClearwaterTesting(object):
                         'Account %s is created on Ellis\n%s',
                         params.get('full_name'), account_res)
                     return account_res
-                else:
-                    raise Exception("Cannot create ellis account")
+                raise Exception("Cannot create ellis account")
             except Exception:  # pylint: disable=broad-except
                 self.logger.info(
                     "try %s: cannot create ellis account", iloop + 1)
@@ -110,8 +109,7 @@ class ClearwaterTesting(object):
                     cookies = req.cookies
                     self.logger.debug('cookies: %s', cookies)
                     return cookies
-                else:
-                    raise Exception('Failed to get cookies for Ellis')
+                raise Exception('Failed to get cookies for Ellis')
             except Exception:  # pylint: disable=broad-except
                 self.logger.info(
                     "try %s: cannot get cookies for Ellis", iloop + 1)
@@ -128,13 +126,12 @@ class ClearwaterTesting(object):
                     self.logger.info(
                         'Calling number is created: %s', number_res)
                     return number_res
+                if req and req.json():
+                    reason = req.json()['reason']
                 else:
-                    if req and req.json():
-                        reason = req.json()['reason']
-                    else:
-                        reason = req
-                    self.logger.info("cannot create a number: %s", reason)
-                    raise Exception('Failed to create a number')
+                    reason = req
+                self.logger.info("cannot create a number: %s", reason)
+                raise Exception('Failed to create a number')
             except Exception:  # pylint: disable=broad-except
                 self.logger.info(
                     "try %s: cannot create a number", iloop + 1)
index 0f6adf9..d937cc0 100644 (file)
@@ -103,7 +103,7 @@ class CloudifyIms(cloudify.Cloudify):
 
     def check_requirements(self):
         if env.get('NEW_USER_ROLE').lower() == "admin":
-            self.__logger.warn(
+            self.__logger.warning(
                 "Defining NEW_USER_ROLE=admin will easily break the testcase "
                 "because Cloudify doesn't manage tenancy (e.g. subnet "
                 "overlapping)")
@@ -250,7 +250,7 @@ class CloudifyIms(cloudify.Cloudify):
         self.result += vnf_test_rate / 3 * 100
         if vnf_test_rate == 0:
             self.details['test_vnf'].update(status='FAIL')
-        return True if vnf_test_rate > 0 else False
+        return bool(vnf_test_rate > 0)
 
     def clean(self):
         """Clean created objects/functions."""
index 9ea9c56..4a57a74 100644 (file)
@@ -234,7 +234,7 @@ class HeatIms(singlevm.VmReady2):
         if vnf_test_rate == 0:
             self.details['test_vnf'].update(status='FAIL')
         self._monit()
-        return True if vnf_test_rate > 0 else False
+        return bool(vnf_test_rate > 0)
 
     def clean(self):
         """Clean created objects/functions."""
index b449d2d..c793953 100644 (file)
@@ -113,7 +113,7 @@ class CloudifyVrouter(cloudify.Cloudify):
 
     def check_requirements(self):
         if env.get('NEW_USER_ROLE').lower() == "admin":
-            self.__logger.warn(
+            self.__logger.warning(
                 "Defining NEW_USER_ROLE=admin will easily break the testcase "
                 "because Cloudify doesn't manage tenancy (e.g. subnet "
                 "overlapping)")
index 0b8a69b..0a56913 100644 (file)
@@ -21,7 +21,7 @@ from functest.opnfv_tests.vnf.router.vnf_controller.vnf_controller import (
     VnfController)
 
 
-class FunctionTestExec(object):
+class FunctionTestExec():
     """vrouter function test execution class"""
 
     logger = logging.getLogger(__name__)
index a54f6cb..2db3b38 100644 (file)
@@ -43,7 +43,7 @@ NUMBER_OF_DIGITS_FOR_AVG_JITTER = 3
 NUMBER_OF_DIGITS_FOR_AVG_PKT_LOSS = 1
 
 
-class Utilvnf(object):  # pylint: disable=too-many-instance-attributes
+class Utilvnf():  # pylint: disable=too-many-instance-attributes
     """ Utility class of vrouter testcase """
 
     logger = logging.getLogger(__name__)
index a7a70f6..d3a216e 100644 (file)
@@ -18,7 +18,7 @@ import re
 from jinja2 import Environment, FileSystemLoader
 
 
-class Checker(object):
+class Checker():
     """vrouter test result check class"""
 
     logger = logging.getLogger(__name__)
index 7d9116b..a86a164 100644 (file)
@@ -15,7 +15,7 @@ import logging
 from jinja2 import Environment, FileSystemLoader
 
 
-class CommandGenerator(object):
+class CommandGenerator():
     """command generator class for vrouter testing"""
 
     logger = logging.getLogger(__name__)
index 6f4a9cf..0969eab 100644 (file)
@@ -24,7 +24,7 @@ DEFAULT_CONNECT_RETRY_COUNT = 10
 DEFAULT_SEND_TIMEOUT = 10
 
 
-class SshClient(object):  # pylint: disable=too-many-instance-attributes
+class SshClient():  # pylint: disable=too-many-instance-attributes
     """ssh client class for vrouter testing"""
 
     logger = logging.getLogger(__name__)
@@ -80,7 +80,7 @@ class SshClient(object):  # pylint: disable=too-many-instance-attributes
                 retrycount -= 1
 
         if retrycount == 0:
-            self.logger.warn(
+            self.logger.warning(
                 "Cannot establish connection to IP '%s'", self.ip_address)
             self.connected = False
             return self.connected
index a738554..b159ddd 100644 (file)
@@ -23,7 +23,7 @@ from functest.opnfv_tests.vnf.router.vnf_controller.ssh_client import (
     SshClient)
 
 
-class VmController(object):
+class VmController():
     """vm controll class"""
 
     logger = logging.getLogger(__name__)
index a5b1ad8..7ed287c 100644 (file)
@@ -26,7 +26,7 @@ from functest.opnfv_tests.vnf.router.vnf_controller.vm_controller import (
     VmController)
 
 
-class VnfController(object):
+class VnfController():
     """vrouter controll class"""
 
     logger = logging.getLogger(__name__)
index 8cfab34..932770b 100644 (file)
@@ -24,7 +24,7 @@ from functest.opnfv_tests.vnf.router.test_controller import function_test_exec
 __author__ = "Shuya Nakama <shuya.nakama@okinawaopenlabs.org>"
 
 
-class VrouterOnBoardingBase(object):
+class VrouterOnBoardingBase():
     """vrouter testing base class"""
 
     def __init__(self, util, util_info):
index 4ec2058..f6a80e2 100644 (file)
@@ -82,7 +82,7 @@ class FunctestUtilsTesting(unittest.TestCase):
     def _get_environ(self, var, *args):  # pylint: disable=unused-argument
         if var == 'INSTALLER_TYPE':
             return self.installer
-        elif var == 'DEPLOY_SCENARIO':
+        if var == 'DEPLOY_SCENARIO':
             return self.scenario
         return var
 
@@ -322,7 +322,7 @@ class FunctestUtilsTesting(unittest.TestCase):
         self.assertEqual(
             functest_utils.convert_dict_to_ini({"a": "b"}), "a:b")
         value = functest_utils.convert_dict_to_ini({"a": "b", "c": "d"})
-        self.assertTrue(value == "a:b,c:d" or value == "c:d,a:b")
+        self.assertTrue(value in ('a:b,c:d', 'c:d,a:b'))
         with self.assertRaises(AssertionError):
             functest_utils.convert_list_to_ini("")
 
index 61d8401..c2897d3 100644 (file)
@@ -10,7 +10,7 @@ import six
 from functest.utils import env
 
 
-class Config(object):
+class Config():
     def __init__(self):
         try:
             # pylint: disable=bad-continuation
diff --git a/tox.ini b/tox.ini
index f63a1e0..fc2f043 100644 (file)
--- a/tox.ini
+++ b/tox.ini
@@ -18,7 +18,7 @@ commands = nosetests --with-xunit \
   functest/tests/unit
 
 [testenv:docs]
-basepython = python2.7
+basepython = python3.6
 commands =
   doc8 \
     --ignore-path api/build \
@@ -32,18 +32,18 @@ commands =
   sphinx-build -W -n -b html -c docs/lfreleng docs docs/_build/html
 
 [testenv:pep8]
-basepython = python2.7
+basepython = python3.6
 commands = flake8
 
 [testenv:pylint]
-basepython = python2.7
+basepython = python3.6
 commands =
   pylint \
     --ignore-imports=y --min-similarity-lines=10 \
     --disable=locally-disabled functest
 
 [testenv:yamllint]
-basepython = python2.7
+basepython = python3.6
 files =
   .travis.yml
   docker
@@ -57,7 +57,7 @@ commands =
   yamllint -s {[testenv:yamllint]files}
 
 [testenv:ansiblelint]
-basepython = python2.7
+basepython = python3.6
 commands =
   ansible-lint ansible/site.yml
 
@@ -65,7 +65,7 @@ commands =
 commands = nosetests functest/tests/unit
 
 [testenv:bashate]
-basepython = python2.7
+basepython = python3.6
 files =
   functest/opnfv_tests/openstack/cinder/write_data.sh
   functest/opnfv_tests/openstack/cinder/read_data.sh
@@ -77,11 +77,11 @@ commands = bashate -e E005,E006,E042,E043 {[testenv:bashate]files}
 
 
 [testenv:bandit]
-basepython = python2.7
+basepython = python3.6
 commands = bandit -r functest -x tests -n 5 -ll -s B601,B602
 
 [testenv:cover]
-basepython = python2.7
+basepython = python3.6
 dirs =
   functest/tests/unit/odl
   functest/tests/unit/openstack/vping
@@ -94,7 +94,7 @@ commands = nosetests --with-coverage --cover-tests \
   --cover-min-percentage 100 {[testenv:cover]dirs}
 
 [testenv:perm]
-basepython = python2.7
+basepython = python3.6
 whitelist_externals = bash
 path=. -not -path './.tox/*' -not -path './.git/*' -not -path './docs/com/pres/reveal.js/*'
 commands =
index 3e18c7a..9d2cd08 100644 (file)
@@ -9,7 +9,7 @@ git+https://gerrit.opnfv.org/gerrit/clover#egg=clover
 git+https://gerrit.opnfv.org/gerrit/parser#egg=nfv-heattranslator&subdirectory=tosca2heat/heat-translator
 git+https://gerrit.opnfv.org/gerrit/parser#egg=nfv-toscaparser&subdirectory=tosca2heat/tosca-parser
 -e git+https://gerrit.opnfv.org/gerrit/parser#egg=nfv-parser
-cloudify-rest-client===4.3.3
+git+https://github.com/collivier/cloudify-rest-client.git@4.3.3-py3#egg=cloudify-rest-client
 robotframework===3.0.2
 robotframework-httplibrary===0.4.2
 robotframework-requests===0.4.7