summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.gitignore6
-rw-r--r--docker/Dockerfile16
-rw-r--r--docker/requirements.pip2
-rw-r--r--functest/__init__.py (renamed from __init__.py)0
-rw-r--r--functest/ci/__init__.py (renamed from ci/__init__.py)0
-rw-r--r--[-rwxr-xr-x]functest/ci/check_os.sh (renamed from ci/check_os.sh)0
-rw-r--r--functest/ci/config_functest.yaml (renamed from ci/config_functest.yaml)14
-rw-r--r--functest/ci/config_patch.yaml (renamed from ci/config_patch.yaml)0
-rw-r--r--[-rwxr-xr-x]functest/ci/exec_test.sh (renamed from ci/exec_test.sh)41
-rw-r--r--[-rwxr-xr-x]functest/ci/generate_report.py (renamed from ci/generate_report.py)1
-rw-r--r--[-rwxr-xr-x]functest/ci/prepare_env.py (renamed from ci/prepare_env.py)4
-rw-r--r--[-rwxr-xr-x]functest/ci/run_tests.py (renamed from ci/run_tests.py)0
-rw-r--r--functest/ci/testcases.yaml (renamed from ci/testcases.yaml)2
-rw-r--r--functest/ci/tier_builder.py (renamed from ci/tier_builder.py)0
-rw-r--r--functest/ci/tier_handler.py (renamed from ci/tier_handler.py)0
-rw-r--r--functest/cli/__init__.py (renamed from cli/__init__.py)0
-rw-r--r--functest/cli/cli_base.py (renamed from cli/cli_base.py)0
-rw-r--r--functest/cli/commands/__init__.py (renamed from cli/commands/__init__.py)0
-rw-r--r--functest/cli/commands/cli_env.py (renamed from cli/commands/cli_env.py)3
-rw-r--r--functest/cli/commands/cli_os.py (renamed from cli/commands/cli_os.py)2
-rw-r--r--functest/cli/commands/cli_testcase.py (renamed from cli/commands/cli_testcase.py)0
-rw-r--r--functest/cli/commands/cli_tier.py (renamed from cli/commands/cli_tier.py)0
-rw-r--r--functest/cli/functest-complete.sh (renamed from cli/functest-complete.sh)0
-rw-r--r--functest/cli/setup.py (renamed from cli/setup.py)0
-rw-r--r--functest/core/TestCasesBase.py (renamed from core/TestCasesBase.py)0
-rw-r--r--functest/core/__init__.py (renamed from core/__init__.py)0
-rwxr-xr-xfunctest/opnfv_tests/Controllers/ODL/OpenDaylightTesting.py (renamed from testcases/Controllers/ODL/OpenDaylightTesting.py)17
-rw-r--r--functest/opnfv_tests/Controllers/ODL/__init__.py (renamed from testcases/Controllers/ODL/__init__.py)0
-rw-r--r--functest/opnfv_tests/Controllers/ONOS/Sfc/README.md (renamed from testcases/Controllers/ONOS/Sfc/README.md)0
-rwxr-xr-x[-rw-r--r--]functest/opnfv_tests/Controllers/ONOS/Sfc/Sfc.py (renamed from testcases/Controllers/ONOS/Sfc/Sfc.py)0
-rw-r--r--functest/opnfv_tests/Controllers/ONOS/Sfc/Sfc_fun.py (renamed from testcases/Controllers/ONOS/Sfc/Sfc_fun.py)0
-rw-r--r--functest/opnfv_tests/Controllers/ONOS/Teston/Readme.txt (renamed from testcases/Controllers/ONOS/Teston/Readme.txt)0
-rw-r--r--functest/opnfv_tests/Controllers/ONOS/Teston/__init__.py (renamed from testcases/Controllers/ONOS/Teston/__init__.py)0
-rw-r--r--functest/opnfv_tests/Controllers/ONOS/Teston/adapters/__init__.py (renamed from testcases/Controllers/ONOS/Teston/adapters/__init__.py)0
-rw-r--r--functest/opnfv_tests/Controllers/ONOS/Teston/adapters/client.py (renamed from testcases/Controllers/ONOS/Teston/adapters/client.py)0
-rw-r--r--functest/opnfv_tests/Controllers/ONOS/Teston/adapters/connection.py (renamed from testcases/Controllers/ONOS/Teston/adapters/connection.py)0
-rw-r--r--functest/opnfv_tests/Controllers/ONOS/Teston/adapters/environment.py (renamed from testcases/Controllers/ONOS/Teston/adapters/environment.py)0
-rw-r--r--functest/opnfv_tests/Controllers/ONOS/Teston/adapters/foundation.py (renamed from testcases/Controllers/ONOS/Teston/adapters/foundation.py)4
-rw-r--r--functest/opnfv_tests/Controllers/ONOS/Teston/dependencies/onos (renamed from testcases/Controllers/ONOS/Teston/dependencies/onos)0
-rw-r--r--functest/opnfv_tests/Controllers/ONOS/Teston/log/gitignore (renamed from testcases/Controllers/ONOS/Teston/log/gitignore)0
-rwxr-xr-xfunctest/opnfv_tests/Controllers/ONOS/Teston/onosfunctest.py (renamed from testcases/Controllers/ONOS/Teston/onosfunctest.py)0
-rw-r--r--functest/opnfv_tests/Controllers/__init__.py (renamed from testcases/Controllers/__init__.py)0
-rwxr-xr-xfunctest/opnfv_tests/OpenStack/examples/create_instance_and_ip.py (renamed from testcases/OpenStack/examples/create_instance_and_ip.py)0
-rwxr-xr-xfunctest/opnfv_tests/OpenStack/healthcheck/healthcheck.sh (renamed from testcases/OpenStack/healthcheck/healthcheck.sh)0
-rw-r--r--functest/opnfv_tests/OpenStack/rally/blacklist.txt (renamed from testcases/OpenStack/rally/blacklist.txt)0
-rw-r--r--functest/opnfv_tests/OpenStack/rally/macro/macro.yaml (renamed from testcases/OpenStack/rally/macro/macro.yaml)0
-rwxr-xr-xfunctest/opnfv_tests/OpenStack/rally/run_rally-cert.py (renamed from testcases/OpenStack/rally/run_rally-cert.py)0
-rw-r--r--functest/opnfv_tests/OpenStack/rally/scenario/full/opnfv-cinder.yaml (renamed from testcases/OpenStack/rally/scenario/full/opnfv-cinder.yaml)0
-rw-r--r--functest/opnfv_tests/OpenStack/rally/scenario/full/opnfv-heat.yaml (renamed from testcases/OpenStack/rally/scenario/full/opnfv-heat.yaml)0
-rw-r--r--functest/opnfv_tests/OpenStack/rally/scenario/full/opnfv-neutron.yaml (renamed from testcases/OpenStack/rally/scenario/full/opnfv-neutron.yaml)0
-rw-r--r--functest/opnfv_tests/OpenStack/rally/scenario/full/opnfv-nova.yaml (renamed from testcases/OpenStack/rally/scenario/full/opnfv-nova.yaml)0
-rw-r--r--functest/opnfv_tests/OpenStack/rally/scenario/opnfv-authenticate.yaml (renamed from testcases/OpenStack/rally/scenario/opnfv-authenticate.yaml)0
-rw-r--r--functest/opnfv_tests/OpenStack/rally/scenario/opnfv-glance.yaml (renamed from testcases/OpenStack/rally/scenario/opnfv-glance.yaml)0
-rw-r--r--functest/opnfv_tests/OpenStack/rally/scenario/opnfv-keystone.yaml (renamed from testcases/OpenStack/rally/scenario/opnfv-keystone.yaml)0
-rw-r--r--functest/opnfv_tests/OpenStack/rally/scenario/opnfv-quotas.yaml (renamed from testcases/OpenStack/rally/scenario/opnfv-quotas.yaml)0
-rw-r--r--functest/opnfv_tests/OpenStack/rally/scenario/opnfv-requests.yaml (renamed from testcases/OpenStack/rally/scenario/opnfv-requests.yaml)0
-rw-r--r--functest/opnfv_tests/OpenStack/rally/scenario/opnfv-vm.yaml (renamed from testcases/OpenStack/rally/scenario/opnfv-vm.yaml)0
-rw-r--r--functest/opnfv_tests/OpenStack/rally/scenario/sanity/opnfv-cinder.yaml (renamed from testcases/OpenStack/rally/scenario/sanity/opnfv-cinder.yaml)0
-rw-r--r--functest/opnfv_tests/OpenStack/rally/scenario/sanity/opnfv-heat.yaml (renamed from testcases/OpenStack/rally/scenario/sanity/opnfv-heat.yaml)0
-rw-r--r--functest/opnfv_tests/OpenStack/rally/scenario/sanity/opnfv-neutron.yaml (renamed from testcases/OpenStack/rally/scenario/sanity/opnfv-neutron.yaml)0
-rw-r--r--functest/opnfv_tests/OpenStack/rally/scenario/sanity/opnfv-nova.yaml (renamed from testcases/OpenStack/rally/scenario/sanity/opnfv-nova.yaml)0
-rwxr-xr-xfunctest/opnfv_tests/OpenStack/rally/scenario/support/instance_dd_test.sh (renamed from testcases/OpenStack/rally/scenario/support/instance_dd_test.sh)0
-rw-r--r--functest/opnfv_tests/OpenStack/rally/scenario/templates/autoscaling_policy.yaml.template (renamed from testcases/OpenStack/rally/scenario/templates/autoscaling_policy.yaml.template)0
-rw-r--r--functest/opnfv_tests/OpenStack/rally/scenario/templates/default.yaml.template (renamed from testcases/OpenStack/rally/scenario/templates/default.yaml.template)0
-rw-r--r--functest/opnfv_tests/OpenStack/rally/scenario/templates/random_strings.yaml.template (renamed from testcases/OpenStack/rally/scenario/templates/random_strings.yaml.template)0
-rw-r--r--functest/opnfv_tests/OpenStack/rally/scenario/templates/resource_group.yaml.template (renamed from testcases/OpenStack/rally/scenario/templates/resource_group.yaml.template)0
-rw-r--r--functest/opnfv_tests/OpenStack/rally/scenario/templates/server_with_ports.yaml.template (renamed from testcases/OpenStack/rally/scenario/templates/server_with_ports.yaml.template)0
-rw-r--r--functest/opnfv_tests/OpenStack/rally/scenario/templates/server_with_volume.yaml.template (renamed from testcases/OpenStack/rally/scenario/templates/server_with_volume.yaml.template)0
-rw-r--r--functest/opnfv_tests/OpenStack/rally/scenario/templates/updated_autoscaling_policy_inplace.yaml.template (renamed from testcases/OpenStack/rally/scenario/templates/updated_autoscaling_policy_inplace.yaml.template)0
-rw-r--r--functest/opnfv_tests/OpenStack/rally/scenario/templates/updated_random_strings_add.yaml.template (renamed from testcases/OpenStack/rally/scenario/templates/updated_random_strings_add.yaml.template)0
-rw-r--r--functest/opnfv_tests/OpenStack/rally/scenario/templates/updated_random_strings_delete.yaml.template (renamed from testcases/OpenStack/rally/scenario/templates/updated_random_strings_delete.yaml.template)0
-rw-r--r--functest/opnfv_tests/OpenStack/rally/scenario/templates/updated_random_strings_replace.yaml.template (renamed from testcases/OpenStack/rally/scenario/templates/updated_random_strings_replace.yaml.template)0
-rw-r--r--functest/opnfv_tests/OpenStack/rally/scenario/templates/updated_resource_group_increase.yaml.template (renamed from testcases/OpenStack/rally/scenario/templates/updated_resource_group_increase.yaml.template)0
-rw-r--r--functest/opnfv_tests/OpenStack/rally/scenario/templates/updated_resource_group_reduce.yaml.template (renamed from testcases/OpenStack/rally/scenario/templates/updated_resource_group_reduce.yaml.template)0
-rw-r--r--functest/opnfv_tests/OpenStack/rally/task.yaml (renamed from testcases/OpenStack/rally/task.yaml)0
-rw-r--r--functest/opnfv_tests/OpenStack/tempest/custom_tests/blacklist.txt (renamed from testcases/OpenStack/tempest/custom_tests/blacklist.txt)0
-rw-r--r--functest/opnfv_tests/OpenStack/tempest/custom_tests/defcore_req.txt (renamed from testcases/OpenStack/tempest/custom_tests/defcore_req.txt)0
-rwxr-xr-xfunctest/opnfv_tests/OpenStack/tempest/gen_tempest_conf.py (renamed from testcases/OpenStack/tempest/gen_tempest_conf.py)0
-rwxr-xr-xfunctest/opnfv_tests/OpenStack/tempest/run_tempest.py (renamed from testcases/OpenStack/tempest/run_tempest.py)0
-rwxr-xr-xfunctest/opnfv_tests/OpenStack/vPing/ping.sh (renamed from testcases/OpenStack/vPing/ping.sh)0
-rwxr-xr-xfunctest/opnfv_tests/OpenStack/vPing/vping.py (renamed from testcases/OpenStack/vPing/vping.py)0
-rw-r--r--functest/opnfv_tests/OpenStack/vPing/vping_util.py (renamed from testcases/OpenStack/vPing/vping_util.py)2
-rw-r--r--functest/opnfv_tests/__init__.py (renamed from testcases/__init__.py)0
-rwxr-xr-xfunctest/opnfv_tests/features/copper.py (renamed from testcases/features/copper.py)0
-rwxr-xr-xfunctest/opnfv_tests/features/doctor.py (renamed from testcases/features/doctor.py)0
-rwxr-xr-xfunctest/opnfv_tests/features/domino.py (renamed from testcases/features/domino.py)0
-rwxr-xr-xfunctest/opnfv_tests/features/multisite.py (renamed from testcases/features/multisite.py)0
-rwxr-xr-xfunctest/opnfv_tests/features/promise.py (renamed from testcases/features/promise.py)0
-rw-r--r--functest/opnfv_tests/features/sfc/SSHUtils.py (renamed from testcases/features/sfc/SSHUtils.py)0
-rwxr-xr-xfunctest/opnfv_tests/features/sfc/compute_presetup_CI.bash (renamed from testcases/features/sfc/compute_presetup_CI.bash)0
-rwxr-xr-xfunctest/opnfv_tests/features/sfc/correct_classifier.bash (renamed from testcases/features/sfc/correct_classifier.bash)0
-rwxr-xr-xfunctest/opnfv_tests/features/sfc/delete.sh (renamed from testcases/features/sfc/delete.sh)0
-rw-r--r--functest/opnfv_tests/features/sfc/ovs_utils.py (renamed from testcases/features/sfc/ovs_utils.py)22
-rwxr-xr-xfunctest/opnfv_tests/features/sfc/prepare_odl_sfc.bash (renamed from testcases/features/sfc/prepare_odl_sfc.bash)2
-rwxr-xr-xfunctest/opnfv_tests/features/sfc/prepare_odl_sfc.py (renamed from testcases/features/sfc/prepare_odl_sfc.py)2
-rwxr-xr-xfunctest/opnfv_tests/features/sfc/server_presetup_CI.bash (renamed from testcases/features/sfc/server_presetup_CI.bash)0
-rwxr-xr-xfunctest/opnfv_tests/features/sfc/sfc.py585
-rwxr-xr-xfunctest/opnfv_tests/features/sfc/sfc_change_classi.bash (renamed from testcases/features/sfc/sfc_change_classi.bash)0
-rwxr-xr-xfunctest/opnfv_tests/features/sfc/sfc_colorado1.py (renamed from testcases/features/sfc/sfc_colorado1.py)15
-rwxr-xr-xfunctest/opnfv_tests/features/sfc/sfc_tacker.bash (renamed from testcases/features/sfc/sfc_tacker.bash)0
-rwxr-xr-xfunctest/opnfv_tests/features/sfc/tacker_client_install.sh (renamed from testcases/features/sfc/tacker_client_install.sh)2
-rw-r--r--functest/opnfv_tests/features/sfc/test-vnfd1.yaml (renamed from testcases/features/sfc/test-vnfd1.yaml)0
-rw-r--r--functest/opnfv_tests/features/sfc/test-vnfd2.yaml (renamed from testcases/features/sfc/test-vnfd2.yaml)0
-rw-r--r--functest/opnfv_tests/security_scan/config.ini (renamed from testcases/security_scan/config.ini)0
-rw-r--r--functest/opnfv_tests/security_scan/connect.py (renamed from testcases/security_scan/connect.py)0
-rw-r--r--functest/opnfv_tests/security_scan/examples/xccdf-rhel7-server-upstream.ini (renamed from testcases/security_scan/examples/xccdf-rhel7-server-upstream.ini)0
-rw-r--r--functest/opnfv_tests/security_scan/examples/xccdf-standard.ini (renamed from testcases/security_scan/examples/xccdf-standard.ini)0
-rw-r--r--functest/opnfv_tests/security_scan/scripts/createfiles.py (renamed from testcases/security_scan/scripts/createfiles.py)0
-rw-r--r--functest/opnfv_tests/security_scan/scripts/internet_check.py (renamed from testcases/security_scan/scripts/internet_check.py)0
-rwxr-xr-xfunctest/opnfv_tests/security_scan/security_scan.py (renamed from testcases/security_scan/security_scan.py)2
-rw-r--r--functest/opnfv_tests/vnf/vIMS/clearwater.py (renamed from testcases/vnf/vIMS/clearwater.py)0
-rwxr-xr-xfunctest/opnfv_tests/vnf/vIMS/create_venv.sh (renamed from testcases/vnf/vIMS/create_venv.sh)0
-rw-r--r--functest/opnfv_tests/vnf/vIMS/orchestrator.py (renamed from testcases/vnf/vIMS/orchestrator.py)0
-rw-r--r--functest/opnfv_tests/vnf/vIMS/requirements.pip (renamed from testcases/vnf/vIMS/requirements.pip)0
-rwxr-xr-xfunctest/opnfv_tests/vnf/vIMS/vIMS.py (renamed from testcases/vnf/vIMS/vIMS.py)0
-rwxr-xr-xfunctest/opnfv_tests/vnf/vRNC/parser.py (renamed from testcases/vnf/vRNC/parser.py)0
-rw-r--r--functest/tests/__init__.py (renamed from unit_tests/__init__.py)0
-rw-r--r--functest/tests/unit/__init__.py (renamed from unit_tests/core/__init__.py)0
-rw-r--r--functest/tests/unit/core/__init__.py (renamed from unit_tests/odl/__init__.py)0
-rw-r--r--functest/tests/unit/core/test_base.py (renamed from unit_tests/core/test_base.py)0
-rw-r--r--functest/tests/unit/odl/__init__.py (renamed from utils/__init__.py)0
-rw-r--r--functest/tests/unit/odl/test_odl.py (renamed from unit_tests/odl/test_odl.py)67
-rw-r--r--functest/tests/unit/utils/__init__.py0
-rw-r--r--functest/tests/unit/utils/test_utils.py29
-rw-r--r--functest/utils/__init__.py0
-rw-r--r--functest/utils/functest_logger.py (renamed from utils/functest_logger.py)0
-rw-r--r--functest/utils/functest_utils.py (renamed from utils/functest_utils.py)2
-rw-r--r--functest/utils/functest_vacation.py (renamed from utils/functest_vacation.py)0
-rwxr-xr-xfunctest/utils/openstack_clean.py (renamed from utils/openstack_clean.py)0
-rwxr-xr-xfunctest/utils/openstack_snapshot.py (renamed from utils/openstack_snapshot.py)0
-rw-r--r--functest/utils/openstack_tacker.py (renamed from utils/openstack_tacker.py)0
-rwxr-xr-xfunctest/utils/openstack_utils.py (renamed from utils/openstack_utils.py)0
-rwxr-xr-xrun_unit_tests.sh61
-rw-r--r--setup.py2
-rw-r--r--testcases/Controllers/ODL/custom_tests/neutron/001__reachability.robot30
-rwxr-xr-xtestcases/features/sfc/sfc.py552
136 files changed, 776 insertions, 711 deletions
diff --git a/.gitignore b/.gitignore
index 80f567613..0bb8500aa 100644
--- a/.gitignore
+++ b/.gitignore
@@ -8,3 +8,9 @@ rally_conf.json
/docs_output/
/releng/
.idea
+.coverage
+cover
+coverage.xml
+nosetests.xml
+functest.egg-info
+*venv
diff --git a/docker/Dockerfile b/docker/Dockerfile
index 9ff0f4f62..a51e3046e 100644
--- a/docker/Dockerfile
+++ b/docker/Dockerfile
@@ -30,7 +30,7 @@ LABEL version="0.1" description="OPNFV Functest Docker container"
ARG BRANCH=master
ARG TEMPEST_TAG=12.2.0
-ARG RALLY_TAG=0.5.0
+ARG RALLY_TAG=0.7.0
ARG ODL_TAG=release/beryllium-sr3
ARG OPENSTACK_TAG=stable/mitaka
ARG KINGBIRD_TAG=0.2.2
@@ -41,7 +41,8 @@ ENV creds /home/opnfv/functest/conf/openstack.creds
ENV TERM xterm
ENV COLORTERM gnome-terminal
ENV PYTHONPATH $PYTHONPATH:/home/opnfv/repos/
-ENV CONFIG_FUNCTEST_YAML /home/opnfv/repos/functest/ci/config_functest.yaml
+ENV CONFIG_FUNCTEST_YAML /home/opnfv/repos/functest/functest/ci/config_functest.yaml
+ENV PYTHONPATH $PYTHONPATH:/home/opnfv/repos/:/home/opnfv/repos/functest
WORKDIR /home/opnfv
# Packaged dependencies
@@ -53,7 +54,7 @@ git \
gcc \
wget \
python-dev \
-python-mock \
+python-mock \
python-pip \
bundler \
postgresql \
@@ -107,7 +108,8 @@ RUN pip install -r ${repos_dir}/functest/docker/requirements.pip
RUN pip install -r ${repos_dir}/rally/requirements.txt
RUN pip install -r ${repos_dir}/tempest/requirements.txt
-RUN find ${repos_dir}/functest -name "*.py" |xargs grep __main__ |cut -d\: -f 1 |xargs chmod -c 755
+RUN find ${repos_dir}/functest -name "*.py" \
+ -not -path *unit_tests* |xargs grep __main__ |cut -d\: -f 1 |xargs chmod -c 755
RUN find ${repos_dir}/functest -name "*.sh" |xargs grep \#\! |cut -d\: -f 1 |xargs chmod -c 755
RUN /bin/bash ${repos_dir}/parser/tests/parser_install.sh ${repos_dir}
@@ -120,7 +122,7 @@ ADD http://205.177.226.237:9999/onosfw/firewall_block_image.img /home/opnfv/func
RUN gpg --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3
RUN curl -L https://get.rvm.io | bash -s stable
-RUN /bin/bash -c ". /home/opnfv/repos/functest/testcases/features/sfc/tacker_client_install.sh"
+RUN /bin/bash -c ". /home/opnfv/repos/functest/functest/opnfv_tests/features/sfc/tacker_client_install.sh"
RUN cd ${repos_dir}/bgpvpn && pip install .
RUN cd ${repos_dir}/kingbird && pip install -e .
RUN cd ${repos_dir}/moon/moonclient/ && python setup.py install
@@ -148,6 +150,6 @@ set backspace=2" \
>> /home/opnfv/.vimrc
RUN echo set nocompatible >> /home/opnfv/.exrc
RUN echo "alias ll='ls -lh' \n\
-. /home/opnfv/repos/functest/cli/functest-complete.sh" \
+. /home/opnfv/repos/functest/functest/cli/functest-complete.sh" \
>> /home/opnfv/.bashrc
-RUN cd ${repos_dir}/functest/cli && pip install .
+RUN cd ${repos_dir}/functest/functest/cli && pip install .
diff --git a/docker/requirements.pip b/docker/requirements.pip
index 6c3a195fc..c3f77997c 100644
--- a/docker/requirements.pip
+++ b/docker/requirements.pip
@@ -11,7 +11,7 @@ pyyaml==3.10
gitpython==1.0.1
python-openstackclient==2.3.0
python-ceilometerclient==1.5.1
-python-keystoneclient==2.3.1
+python-keystoneclient==3.6.0
python-neutronclient==4.1.1
virtualenv==1.11.4
pexpect==4.0
diff --git a/__init__.py b/functest/__init__.py
index e69de29bb..e69de29bb 100644
--- a/__init__.py
+++ b/functest/__init__.py
diff --git a/ci/__init__.py b/functest/ci/__init__.py
index e69de29bb..e69de29bb 100644
--- a/ci/__init__.py
+++ b/functest/ci/__init__.py
diff --git a/ci/check_os.sh b/functest/ci/check_os.sh
index 38fe32f58..38fe32f58 100755..100644
--- a/ci/check_os.sh
+++ b/functest/ci/check_os.sh
diff --git a/ci/config_functest.yaml b/functest/ci/config_functest.yaml
index d6497678a..cca4959a9 100644
--- a/ci/config_functest.yaml
+++ b/functest/ci/config_functest.yaml
@@ -1,13 +1,13 @@
general:
directories:
# Relative to the path where the repo is cloned:
- dir_vping: testcases/OpenStack/vPing/
- dir_odl: testcases/Controllers/ODL/
- dir_rally: testcases/OpenStack/rally/
- dir_tempest_cases: testcases/OpenStack/tempest/custom_tests/
- dir_vIMS: testcases/vnf/vIMS/
- dir_onos: testcases/Controllers/ONOS/Teston/
- dir_onos_sfc: testcases/Controllers/ONOS/Sfc/
+ dir_vping: functest/opnfv_tests/OpenStack/vPing/
+ dir_odl: functest/opnfv_tests/Controllers/ODL/
+ dir_rally: functest/opnfv_tests/OpenStack/rally/
+ dir_tempest_cases: functest/opnfv_tests/OpenStack/tempest/custom_tests/
+ dir_vIMS: functest/opnfv_tests/vnf/vIMS/
+ dir_onos: functest/opnfv_tests/Controllers/ONOS/Teston/
+ dir_onos_sfc: functest/opnfv_tests/Controllers/ONOS/Sfc/
# Absolute path
dir_repos: /home/opnfv/repos
diff --git a/ci/config_patch.yaml b/functest/ci/config_patch.yaml
index 46064a07f..46064a07f 100644
--- a/ci/config_patch.yaml
+++ b/functest/ci/config_patch.yaml
diff --git a/ci/exec_test.sh b/functest/ci/exec_test.sh
index 6fdc42666..640180059 100755..100644
--- a/ci/exec_test.sh
+++ b/functest/ci/exec_test.sh
@@ -37,6 +37,7 @@ if [[ "${CI_DEBUG,,}" == "true" ]];then
fi
FUNCTEST_REPO_DIR=${repos_dir}/functest
+FUNCTEST_TEST_DIR=${repos_dir}/functest/functest/opnfv_tests
FUNCTEST_CONF_DIR=/home/opnfv/functest/conf
export PYTHONUNBUFFERED=1
@@ -81,39 +82,39 @@ function run_test(){
case $test_name in
"healthcheck")
- ${FUNCTEST_REPO_DIR}/testcases/OpenStack/healthcheck/healthcheck.sh
+ ${FUNCTEST_TEST_DIR}/OpenStack/healthcheck/healthcheck.sh
;;
"vping_ssh")
- python ${FUNCTEST_REPO_DIR}/testcases/OpenStack/vPing/vping.py -m ssh $report
+ python ${FUNCTEST_TEST_DIR}/OpenStack/vPing/vping.py -m ssh $report
;;
"vping_userdata")
- python ${FUNCTEST_REPO_DIR}/testcases/OpenStack/vPing/vping.py -m userdata $report
+ python ${FUNCTEST_TEST_DIR}/OpenStack/vPing/vping.py -m userdata $report
;;
"odl")
odl_tests
[[ "$report" == "-r" ]] && args=-p
- ${FUNCTEST_REPO_DIR}/testcases/Controllers/ODL/OpenDaylightTesting.py \
+ ${FUNCTEST_TEST_DIR}/Controllers/ODL/OpenDaylightTesting.py \
--keystoneip $keystone_ip --neutronip $neutron_ip \
--osusername ${OS_USERNAME} --ostenantname ${OS_TENANT_NAME} \
--ospassword ${OS_PASSWORD} \
--odlip $odl_ip --odlwebport $odl_port ${args}
;;
"tempest_smoke_serial")
- python ${FUNCTEST_REPO_DIR}/testcases/OpenStack/tempest/run_tempest.py \
+ python ${FUNCTEST_TEST_DIR}/OpenStack/tempest/run_tempest.py \
$clean_flag -s -m smoke $report
;;
"tempest_full_parallel")
- python ${FUNCTEST_REPO_DIR}/testcases/OpenStack/tempest/run_tempest.py \
+ python ${FUNCTEST_TEST_DIR}/OpenStack/tempest/run_tempest.py \
$serial_flag $clean_flag -m full $report
;;
"vims")
- python ${FUNCTEST_REPO_DIR}/testcases/vnf/vIMS/vIMS.py $clean_flag $report
+ python ${FUNCTEST_TEST_DIR}/vnf/vIMS/vIMS.py $clean_flag $report
;;
"rally_full")
- python ${FUNCTEST_REPO_DIR}/testcases/OpenStack/rally/run_rally-cert.py $clean_flag all $report
+ python ${FUNCTEST_TEST_DIR}/OpenStack/rally/run_rally-cert.py $clean_flag all $report
;;
"rally_sanity")
- python ${FUNCTEST_REPO_DIR}/testcases/OpenStack/rally/run_rally-cert.py \
+ python ${FUNCTEST_TEST_DIR}/OpenStack/rally/run_rally-cert.py \
$clean_flag --sanity all $report
;;
"bgpvpn")
@@ -121,17 +122,17 @@ function run_test(){
python ${sdnvpn_repo_dir}/run_tests.py $report
;;
"onos")
- python ${FUNCTEST_REPO_DIR}/testcases/Controllers/ONOS/Teston/onosfunctest.py
+ python ${FUNCTEST_TEST_DIR}/Controllers/ONOS/Teston/onosfunctest.py
;;
"onos_sfc")
- python ${FUNCTEST_REPO_DIR}/testcases/Controllers/ONOS/Teston/onosfunctest.py -t sfc
+ python ${FUNCTEST_TEST_DIR}/Controllers/ONOS/Teston/onosfunctest.py -t sfc
;;
"promise")
- python ${FUNCTEST_REPO_DIR}/testcases/features/promise.py $report
+ python ${FUNCTEST_TEST_DIR}/features/promise.py $report
sleep 10 # to let the instances terminate
;;
"doctor")
- python ${FUNCTEST_REPO_DIR}/testcases/features/doctor.py $report
+ python ${FUNCTEST_TEST_DIR}/features/doctor.py $report
;;
"ovno")
# suite under rewritting for colorado
@@ -144,29 +145,29 @@ function run_test(){
python ${repos_dir}/securityscanning/security_scan.py --config ${repos_dir}/securityscanning/config.ini
;;
"copper")
- python ${FUNCTEST_REPO_DIR}/testcases/features/copper.py $report
+ python ${FUNCTEST_TEST_DIR}/features/copper.py $report
;;
"moon")
python ${repos_dir}/moon/tests/run_tests.py $report
;;
"multisite")
- python ${FUNCTEST_REPO_DIR}/testcases/OpenStack/tempest/gen_tempest_conf.py
- python ${FUNCTEST_REPO_DIR}/testcases/OpenStack/tempest/run_tempest.py \
+ python ${FUNCTEST_TEST_DIR}/OpenStack/tempest/gen_tempest_conf.py
+ python ${FUNCTEST_TEST_DIR}/OpenStack/tempest/run_tempest.py \
$clean_flag -s -m feature_multisite $report \
- -c ${FUNCTEST_REPO_DIR}/testcases/OpenStack/tempest/tempest_multisite.conf
+ -c ${FUNCTEST_TEST_DIR}/OpenStack/tempest/tempest_multisite.conf
;;
"domino")
- python ${FUNCTEST_REPO_DIR}/testcases/features/domino.py $report
+ python ${FUNCTEST_TEST_DIR}/features/domino.py $report
;;
"odl-sfc")
- ODL_SFC_DIR=${FUNCTEST_REPO_DIR}/testcases/features/sfc
+ ODL_SFC_DIR=${FUNCTEST_TEST_DIR}/features/sfc
# pass FUNCTEST_REPO_DIR inside prepare_odl_sfc.bash
FUNCTEST_REPO_DIR=${FUNCTEST_REPO_DIR} python ${ODL_SFC_DIR}/prepare_odl_sfc.py || exit $?
source ${ODL_SFC_DIR}/tackerc
python ${ODL_SFC_DIR}/sfc_colorado1.py $report
;;
"parser")
- python ${FUNCTEST_REPO_DIR}/testcases/vnf/vRNC/parser.py $report
+ python ${FUNCTEST_TEST_DIR}/vnf/vRNC/parser.py $report
;;
*)
echo "The test case '${test_name}' does not exist."
diff --git a/ci/generate_report.py b/functest/ci/generate_report.py
index d2e09eb80..c93437294 100755..100644
--- a/ci/generate_report.py
+++ b/functest/ci/generate_report.py
@@ -2,6 +2,7 @@ import json
import os
import re
import urllib2
+
import functest.utils.functest_logger as ft_logger
import functest.utils.functest_utils as ft_utils
diff --git a/ci/prepare_env.py b/functest/ci/prepare_env.py
index e110aa572..e5c24cc30 100755..100644
--- a/ci/prepare_env.py
+++ b/functest/ci/prepare_env.py
@@ -109,7 +109,7 @@ def check_env_variables():
if CI_SCENARIO is None:
logger.warning("The env variable 'DEPLOY_SCENARIO' is not defined. "
- "Setting CE_SCENARIO=undefined.")
+ "Setting CI_SCENARIO=undefined.")
CI_SCENARIO = "undefined"
else:
logger.info(" DEPLOY_SCENARIO=%s" % CI_SCENARIO)
@@ -205,7 +205,7 @@ def patch_config_file():
def verify_deployment():
print_separator()
logger.info("Verifying OpenStack services...")
- cmd = ("%s/ci/check_os.sh" % ft_utils.FUNCTEST_REPO)
+ cmd = ("%s/functest/ci/check_os.sh" % ft_utils.FUNCTEST_REPO)
logger.debug("Executing command: %s" % cmd)
p = subprocess.Popen(cmd, stdout=subprocess.PIPE, shell=True)
diff --git a/ci/run_tests.py b/functest/ci/run_tests.py
index f30062f75..f30062f75 100755..100644
--- a/ci/run_tests.py
+++ b/functest/ci/run_tests.py
diff --git a/ci/testcases.yaml b/functest/ci/testcases.yaml
index 22509e611..afd329868 100644
--- a/ci/testcases.yaml
+++ b/functest/ci/testcases.yaml
@@ -93,7 +93,7 @@ tiers:
installer: ''
scenario: 'odl'
run:
- module: 'functest.testcases.Controllers.ODL.OpenDaylightTesting'
+ module: 'functest.opnfv_tests.Controllers.ODL.OpenDaylightTesting'
class: 'ODLTestCases'
-
diff --git a/ci/tier_builder.py b/functest/ci/tier_builder.py
index e1c3e49e6..e1c3e49e6 100644
--- a/ci/tier_builder.py
+++ b/functest/ci/tier_builder.py
diff --git a/ci/tier_handler.py b/functest/ci/tier_handler.py
index 1eadfba50..1eadfba50 100644
--- a/ci/tier_handler.py
+++ b/functest/ci/tier_handler.py
diff --git a/cli/__init__.py b/functest/cli/__init__.py
index e69de29bb..e69de29bb 100644
--- a/cli/__init__.py
+++ b/functest/cli/__init__.py
diff --git a/cli/cli_base.py b/functest/cli/cli_base.py
index 827f8a4b6..827f8a4b6 100644
--- a/cli/cli_base.py
+++ b/functest/cli/cli_base.py
diff --git a/cli/commands/__init__.py b/functest/cli/commands/__init__.py
index e69de29bb..e69de29bb 100644
--- a/cli/commands/__init__.py
+++ b/functest/cli/commands/__init__.py
diff --git a/cli/commands/cli_env.py b/functest/cli/commands/cli_env.py
index 572012643..d331cc15a 100644
--- a/cli/commands/cli_env.py
+++ b/functest/cli/commands/cli_env.py
@@ -19,6 +19,7 @@ FUNCTEST_REPO = ft_utils.FUNCTEST_REPO
class CliEnv:
+
def __init__(self):
pass
@@ -36,7 +37,7 @@ class CliEnv:
else:
answer = raw_input("Invalid answer. Please type [y|n]\n")
- cmd = ("python %s/ci/prepare_env.py start" % FUNCTEST_REPO)
+ cmd = ("python %s/functest/ci/prepare_env.py start" % FUNCTEST_REPO)
ft_utils.execute_command(cmd)
def show(self):
diff --git a/cli/commands/cli_os.py b/functest/cli/commands/cli_os.py
index 2f3f329f3..2530b5f2d 100644
--- a/cli/commands/cli_os.py
+++ b/functest/cli/commands/cli_os.py
@@ -79,7 +79,7 @@ class CliOpenStack:
def check(self):
self.ping_endpoint()
- cmd = ft_utils.FUNCTEST_REPO + "/ci/check_os.sh"
+ cmd = ft_utils.FUNCTEST_REPO + "/functest/ci/check_os.sh"
ft_utils.execute_command(cmd, verbose=False)
def snapshot_create(self):
diff --git a/cli/commands/cli_testcase.py b/functest/cli/commands/cli_testcase.py
index 510d740ba..510d740ba 100644
--- a/cli/commands/cli_testcase.py
+++ b/functest/cli/commands/cli_testcase.py
diff --git a/cli/commands/cli_tier.py b/functest/cli/commands/cli_tier.py
index aa0541981..aa0541981 100644
--- a/cli/commands/cli_tier.py
+++ b/functest/cli/commands/cli_tier.py
diff --git a/cli/functest-complete.sh b/functest/cli/functest-complete.sh
index f01490713..f01490713 100644
--- a/cli/functest-complete.sh
+++ b/functest/cli/functest-complete.sh
diff --git a/cli/setup.py b/functest/cli/setup.py
index 21547e158..21547e158 100644
--- a/cli/setup.py
+++ b/functest/cli/setup.py
diff --git a/core/TestCasesBase.py b/functest/core/TestCasesBase.py
index 3d6b82d52..3d6b82d52 100644
--- a/core/TestCasesBase.py
+++ b/functest/core/TestCasesBase.py
diff --git a/core/__init__.py b/functest/core/__init__.py
index e69de29bb..e69de29bb 100644
--- a/core/__init__.py
+++ b/functest/core/__init__.py
diff --git a/testcases/Controllers/ODL/OpenDaylightTesting.py b/functest/opnfv_tests/Controllers/ODL/OpenDaylightTesting.py
index c44be626c..8c003abfd 100755
--- a/testcases/Controllers/ODL/OpenDaylightTesting.py
+++ b/functest/opnfv_tests/Controllers/ODL/OpenDaylightTesting.py
@@ -12,7 +12,6 @@ import errno
import fileinput
import os
import re
-import shutil
import sys
import urlparse
@@ -60,19 +59,6 @@ class ODLTestCases(TestCasesBase.TestCasesBase):
self.case_name = "odl"
@classmethod
- def copy_opnf_testcases(cls):
- opnfv_testcases_dir = (os.path.dirname(os.path.abspath(__file__)) +
- "/custom_tests/neutron/")
- f = opnfv_testcases_dir + "001__reachability.robot"
- try:
- shutil.copy(f, cls.neutron_suite_dir)
- except IOError as e:
- cls.logger.error(
- "Cannot copy OPNFV's testcase to ODL directory: %s" % str(e))
- return False
- return True
-
- @classmethod
def set_robotframework_vars(cls, odlusername="admin", odlpassword="admin"):
odl_variables_files = cls.odl_test_repo + 'csit/variables/Variables.py'
try:
@@ -115,8 +101,7 @@ class ODLTestCases(TestCasesBase.TestCasesBase):
self.logger.error("Cannot run ODL testcases. Please check "
"%s" % str(e))
return self.EX_RUN_ERROR
- if (self.copy_opnf_testcases() and
- self.set_robotframework_vars(odlusername, odlpassword)):
+ if self.set_robotframework_vars(odlusername, odlpassword):
try:
os.makedirs(self.res_dir)
except OSError as e:
diff --git a/testcases/Controllers/ODL/__init__.py b/functest/opnfv_tests/Controllers/ODL/__init__.py
index e69de29bb..e69de29bb 100644
--- a/testcases/Controllers/ODL/__init__.py
+++ b/functest/opnfv_tests/Controllers/ODL/__init__.py
diff --git a/testcases/Controllers/ONOS/Sfc/README.md b/functest/opnfv_tests/Controllers/ONOS/Sfc/README.md
index ae63ee214..ae63ee214 100644
--- a/testcases/Controllers/ONOS/Sfc/README.md
+++ b/functest/opnfv_tests/Controllers/ONOS/Sfc/README.md
diff --git a/testcases/Controllers/ONOS/Sfc/Sfc.py b/functest/opnfv_tests/Controllers/ONOS/Sfc/Sfc.py
index bea2828d2..bea2828d2 100644..100755
--- a/testcases/Controllers/ONOS/Sfc/Sfc.py
+++ b/functest/opnfv_tests/Controllers/ONOS/Sfc/Sfc.py
diff --git a/testcases/Controllers/ONOS/Sfc/Sfc_fun.py b/functest/opnfv_tests/Controllers/ONOS/Sfc/Sfc_fun.py
index 69e076d05..69e076d05 100644
--- a/testcases/Controllers/ONOS/Sfc/Sfc_fun.py
+++ b/functest/opnfv_tests/Controllers/ONOS/Sfc/Sfc_fun.py
diff --git a/testcases/Controllers/ONOS/Teston/Readme.txt b/functest/opnfv_tests/Controllers/ONOS/Teston/Readme.txt
index 7393f59a1..7393f59a1 100644
--- a/testcases/Controllers/ONOS/Teston/Readme.txt
+++ b/functest/opnfv_tests/Controllers/ONOS/Teston/Readme.txt
diff --git a/testcases/Controllers/ONOS/Teston/__init__.py b/functest/opnfv_tests/Controllers/ONOS/Teston/__init__.py
index e69de29bb..e69de29bb 100644
--- a/testcases/Controllers/ONOS/Teston/__init__.py
+++ b/functest/opnfv_tests/Controllers/ONOS/Teston/__init__.py
diff --git a/testcases/Controllers/ONOS/Teston/adapters/__init__.py b/functest/opnfv_tests/Controllers/ONOS/Teston/adapters/__init__.py
index e69de29bb..e69de29bb 100644
--- a/testcases/Controllers/ONOS/Teston/adapters/__init__.py
+++ b/functest/opnfv_tests/Controllers/ONOS/Teston/adapters/__init__.py
diff --git a/testcases/Controllers/ONOS/Teston/adapters/client.py b/functest/opnfv_tests/Controllers/ONOS/Teston/adapters/client.py
index 6b3285e5e..6b3285e5e 100644
--- a/testcases/Controllers/ONOS/Teston/adapters/client.py
+++ b/functest/opnfv_tests/Controllers/ONOS/Teston/adapters/client.py
diff --git a/testcases/Controllers/ONOS/Teston/adapters/connection.py b/functest/opnfv_tests/Controllers/ONOS/Teston/adapters/connection.py
index b2a2e3d88..b2a2e3d88 100644
--- a/testcases/Controllers/ONOS/Teston/adapters/connection.py
+++ b/functest/opnfv_tests/Controllers/ONOS/Teston/adapters/connection.py
diff --git a/testcases/Controllers/ONOS/Teston/adapters/environment.py b/functest/opnfv_tests/Controllers/ONOS/Teston/adapters/environment.py
index f2755b669..f2755b669 100644
--- a/testcases/Controllers/ONOS/Teston/adapters/environment.py
+++ b/functest/opnfv_tests/Controllers/ONOS/Teston/adapters/environment.py
diff --git a/testcases/Controllers/ONOS/Teston/adapters/foundation.py b/functest/opnfv_tests/Controllers/ONOS/Teston/adapters/foundation.py
index 5c42c35e8..603e9933c 100644
--- a/testcases/Controllers/ONOS/Teston/adapters/foundation.py
+++ b/functest/opnfv_tests/Controllers/ONOS/Teston/adapters/foundation.py
@@ -26,10 +26,10 @@ class foundation:
# currentpath = os.getcwd()
REPO_PATH = ft_utils.FUNCTEST_REPO + '/'
- currentpath = REPO_PATH + 'testcases/Controllers/ONOS/Teston/CI'
+ currentpath = REPO_PATH + 'opnfv_tests/Controllers/ONOS/Teston/CI'
self.cipath = currentpath
self.logdir = os.path.join(currentpath, 'log')
- self.workhome = currentpath[0: currentpath.rfind('testcases') - 1]
+ self.workhome = currentpath[0: currentpath.rfind('opnfv_tests') - 1]
self.Result_DB = ''
filename = time.strftime('%Y-%m-%d-%H-%M-%S') + '.log'
self.logfilepath = os.path.join(self.logdir, filename)
diff --git a/testcases/Controllers/ONOS/Teston/dependencies/onos b/functest/opnfv_tests/Controllers/ONOS/Teston/dependencies/onos
index bb02fa899..bb02fa899 100644
--- a/testcases/Controllers/ONOS/Teston/dependencies/onos
+++ b/functest/opnfv_tests/Controllers/ONOS/Teston/dependencies/onos
diff --git a/testcases/Controllers/ONOS/Teston/log/gitignore b/functest/opnfv_tests/Controllers/ONOS/Teston/log/gitignore
index e69de29bb..e69de29bb 100644
--- a/testcases/Controllers/ONOS/Teston/log/gitignore
+++ b/functest/opnfv_tests/Controllers/ONOS/Teston/log/gitignore
diff --git a/testcases/Controllers/ONOS/Teston/onosfunctest.py b/functest/opnfv_tests/Controllers/ONOS/Teston/onosfunctest.py
index c8045fd12..c8045fd12 100755
--- a/testcases/Controllers/ONOS/Teston/onosfunctest.py
+++ b/functest/opnfv_tests/Controllers/ONOS/Teston/onosfunctest.py
diff --git a/testcases/Controllers/__init__.py b/functest/opnfv_tests/Controllers/__init__.py
index e69de29bb..e69de29bb 100644
--- a/testcases/Controllers/__init__.py
+++ b/functest/opnfv_tests/Controllers/__init__.py
diff --git a/testcases/OpenStack/examples/create_instance_and_ip.py b/functest/opnfv_tests/OpenStack/examples/create_instance_and_ip.py
index 50cdf8a57..50cdf8a57 100755
--- a/testcases/OpenStack/examples/create_instance_and_ip.py
+++ b/functest/opnfv_tests/OpenStack/examples/create_instance_and_ip.py
diff --git a/testcases/OpenStack/healthcheck/healthcheck.sh b/functest/opnfv_tests/OpenStack/healthcheck/healthcheck.sh
index 996aadcf7..996aadcf7 100755
--- a/testcases/OpenStack/healthcheck/healthcheck.sh
+++ b/functest/opnfv_tests/OpenStack/healthcheck/healthcheck.sh
diff --git a/testcases/OpenStack/rally/blacklist.txt b/functest/opnfv_tests/OpenStack/rally/blacklist.txt
index 3a17fa616..3a17fa616 100644
--- a/testcases/OpenStack/rally/blacklist.txt
+++ b/functest/opnfv_tests/OpenStack/rally/blacklist.txt
diff --git a/testcases/OpenStack/rally/macro/macro.yaml b/functest/opnfv_tests/OpenStack/rally/macro/macro.yaml
index 48c0333e9..48c0333e9 100644
--- a/testcases/OpenStack/rally/macro/macro.yaml
+++ b/functest/opnfv_tests/OpenStack/rally/macro/macro.yaml
diff --git a/testcases/OpenStack/rally/run_rally-cert.py b/functest/opnfv_tests/OpenStack/rally/run_rally-cert.py
index 8b8adce40..8b8adce40 100755
--- a/testcases/OpenStack/rally/run_rally-cert.py
+++ b/functest/opnfv_tests/OpenStack/rally/run_rally-cert.py
diff --git a/testcases/OpenStack/rally/scenario/full/opnfv-cinder.yaml b/functest/opnfv_tests/OpenStack/rally/scenario/full/opnfv-cinder.yaml
index e844e33f6..e844e33f6 100644
--- a/testcases/OpenStack/rally/scenario/full/opnfv-cinder.yaml
+++ b/functest/opnfv_tests/OpenStack/rally/scenario/full/opnfv-cinder.yaml
diff --git a/testcases/OpenStack/rally/scenario/full/opnfv-heat.yaml b/functest/opnfv_tests/OpenStack/rally/scenario/full/opnfv-heat.yaml
index 6f3a5c163..6f3a5c163 100644
--- a/testcases/OpenStack/rally/scenario/full/opnfv-heat.yaml
+++ b/functest/opnfv_tests/OpenStack/rally/scenario/full/opnfv-heat.yaml
diff --git a/testcases/OpenStack/rally/scenario/full/opnfv-neutron.yaml b/functest/opnfv_tests/OpenStack/rally/scenario/full/opnfv-neutron.yaml
index 0a773533a..0a773533a 100644
--- a/testcases/OpenStack/rally/scenario/full/opnfv-neutron.yaml
+++ b/functest/opnfv_tests/OpenStack/rally/scenario/full/opnfv-neutron.yaml
diff --git a/testcases/OpenStack/rally/scenario/full/opnfv-nova.yaml b/functest/opnfv_tests/OpenStack/rally/scenario/full/opnfv-nova.yaml
index d7622093d..d7622093d 100644
--- a/testcases/OpenStack/rally/scenario/full/opnfv-nova.yaml
+++ b/functest/opnfv_tests/OpenStack/rally/scenario/full/opnfv-nova.yaml
diff --git a/testcases/OpenStack/rally/scenario/opnfv-authenticate.yaml b/functest/opnfv_tests/OpenStack/rally/scenario/opnfv-authenticate.yaml
index a04e4c1c1..a04e4c1c1 100644
--- a/testcases/OpenStack/rally/scenario/opnfv-authenticate.yaml
+++ b/functest/opnfv_tests/OpenStack/rally/scenario/opnfv-authenticate.yaml
diff --git a/testcases/OpenStack/rally/scenario/opnfv-glance.yaml b/functest/opnfv_tests/OpenStack/rally/scenario/opnfv-glance.yaml
index 3a67e7457..3a67e7457 100644
--- a/testcases/OpenStack/rally/scenario/opnfv-glance.yaml
+++ b/functest/opnfv_tests/OpenStack/rally/scenario/opnfv-glance.yaml
diff --git a/testcases/OpenStack/rally/scenario/opnfv-keystone.yaml b/functest/opnfv_tests/OpenStack/rally/scenario/opnfv-keystone.yaml
index bfc9948b3..bfc9948b3 100644
--- a/testcases/OpenStack/rally/scenario/opnfv-keystone.yaml
+++ b/functest/opnfv_tests/OpenStack/rally/scenario/opnfv-keystone.yaml
diff --git a/testcases/OpenStack/rally/scenario/opnfv-quotas.yaml b/functest/opnfv_tests/OpenStack/rally/scenario/opnfv-quotas.yaml
index a0682acce..a0682acce 100644
--- a/testcases/OpenStack/rally/scenario/opnfv-quotas.yaml
+++ b/functest/opnfv_tests/OpenStack/rally/scenario/opnfv-quotas.yaml
diff --git a/testcases/OpenStack/rally/scenario/opnfv-requests.yaml b/functest/opnfv_tests/OpenStack/rally/scenario/opnfv-requests.yaml
index 161369786..161369786 100644
--- a/testcases/OpenStack/rally/scenario/opnfv-requests.yaml
+++ b/functest/opnfv_tests/OpenStack/rally/scenario/opnfv-requests.yaml
diff --git a/testcases/OpenStack/rally/scenario/opnfv-vm.yaml b/functest/opnfv_tests/OpenStack/rally/scenario/opnfv-vm.yaml
index 74f509925..74f509925 100644
--- a/testcases/OpenStack/rally/scenario/opnfv-vm.yaml
+++ b/functest/opnfv_tests/OpenStack/rally/scenario/opnfv-vm.yaml
diff --git a/testcases/OpenStack/rally/scenario/sanity/opnfv-cinder.yaml b/functest/opnfv_tests/OpenStack/rally/scenario/sanity/opnfv-cinder.yaml
index 5962b1db5..5962b1db5 100644
--- a/testcases/OpenStack/rally/scenario/sanity/opnfv-cinder.yaml
+++ b/functest/opnfv_tests/OpenStack/rally/scenario/sanity/opnfv-cinder.yaml
diff --git a/testcases/OpenStack/rally/scenario/sanity/opnfv-heat.yaml b/functest/opnfv_tests/OpenStack/rally/scenario/sanity/opnfv-heat.yaml
index dc34cc3f2..dc34cc3f2 100644
--- a/testcases/OpenStack/rally/scenario/sanity/opnfv-heat.yaml
+++ b/functest/opnfv_tests/OpenStack/rally/scenario/sanity/opnfv-heat.yaml
diff --git a/testcases/OpenStack/rally/scenario/sanity/opnfv-neutron.yaml b/functest/opnfv_tests/OpenStack/rally/scenario/sanity/opnfv-neutron.yaml
index 159f2b633..159f2b633 100644
--- a/testcases/OpenStack/rally/scenario/sanity/opnfv-neutron.yaml
+++ b/functest/opnfv_tests/OpenStack/rally/scenario/sanity/opnfv-neutron.yaml
diff --git a/testcases/OpenStack/rally/scenario/sanity/opnfv-nova.yaml b/functest/opnfv_tests/OpenStack/rally/scenario/sanity/opnfv-nova.yaml
index e2795cf71..e2795cf71 100644
--- a/testcases/OpenStack/rally/scenario/sanity/opnfv-nova.yaml
+++ b/functest/opnfv_tests/OpenStack/rally/scenario/sanity/opnfv-nova.yaml
diff --git a/testcases/OpenStack/rally/scenario/support/instance_dd_test.sh b/functest/opnfv_tests/OpenStack/rally/scenario/support/instance_dd_test.sh
index e3bf23405..e3bf23405 100755
--- a/testcases/OpenStack/rally/scenario/support/instance_dd_test.sh
+++ b/functest/opnfv_tests/OpenStack/rally/scenario/support/instance_dd_test.sh
diff --git a/testcases/OpenStack/rally/scenario/templates/autoscaling_policy.yaml.template b/functest/opnfv_tests/OpenStack/rally/scenario/templates/autoscaling_policy.yaml.template
index a22487e33..a22487e33 100644
--- a/testcases/OpenStack/rally/scenario/templates/autoscaling_policy.yaml.template
+++ b/functest/opnfv_tests/OpenStack/rally/scenario/templates/autoscaling_policy.yaml.template
diff --git a/testcases/OpenStack/rally/scenario/templates/default.yaml.template b/functest/opnfv_tests/OpenStack/rally/scenario/templates/default.yaml.template
index eb4f2f2dd..eb4f2f2dd 100644
--- a/testcases/OpenStack/rally/scenario/templates/default.yaml.template
+++ b/functest/opnfv_tests/OpenStack/rally/scenario/templates/default.yaml.template
diff --git a/testcases/OpenStack/rally/scenario/templates/random_strings.yaml.template b/functest/opnfv_tests/OpenStack/rally/scenario/templates/random_strings.yaml.template
index 2dd676c11..2dd676c11 100644
--- a/testcases/OpenStack/rally/scenario/templates/random_strings.yaml.template
+++ b/functest/opnfv_tests/OpenStack/rally/scenario/templates/random_strings.yaml.template
diff --git a/testcases/OpenStack/rally/scenario/templates/resource_group.yaml.template b/functest/opnfv_tests/OpenStack/rally/scenario/templates/resource_group.yaml.template
index b3f505fa6..b3f505fa6 100644
--- a/testcases/OpenStack/rally/scenario/templates/resource_group.yaml.template
+++ b/functest/opnfv_tests/OpenStack/rally/scenario/templates/resource_group.yaml.template
diff --git a/testcases/OpenStack/rally/scenario/templates/server_with_ports.yaml.template b/functest/opnfv_tests/OpenStack/rally/scenario/templates/server_with_ports.yaml.template
index 909f45d21..909f45d21 100644
--- a/testcases/OpenStack/rally/scenario/templates/server_with_ports.yaml.template
+++ b/functest/opnfv_tests/OpenStack/rally/scenario/templates/server_with_ports.yaml.template
diff --git a/testcases/OpenStack/rally/scenario/templates/server_with_volume.yaml.template b/functest/opnfv_tests/OpenStack/rally/scenario/templates/server_with_volume.yaml.template
index 826ca9dae..826ca9dae 100644
--- a/testcases/OpenStack/rally/scenario/templates/server_with_volume.yaml.template
+++ b/functest/opnfv_tests/OpenStack/rally/scenario/templates/server_with_volume.yaml.template
diff --git a/testcases/OpenStack/rally/scenario/templates/updated_autoscaling_policy_inplace.yaml.template b/functest/opnfv_tests/OpenStack/rally/scenario/templates/updated_autoscaling_policy_inplace.yaml.template
index cf34879ca..cf34879ca 100644
--- a/testcases/OpenStack/rally/scenario/templates/updated_autoscaling_policy_inplace.yaml.template
+++ b/functest/opnfv_tests/OpenStack/rally/scenario/templates/updated_autoscaling_policy_inplace.yaml.template
diff --git a/testcases/OpenStack/rally/scenario/templates/updated_random_strings_add.yaml.template b/functest/opnfv_tests/OpenStack/rally/scenario/templates/updated_random_strings_add.yaml.template
index e06d42e01..e06d42e01 100644
--- a/testcases/OpenStack/rally/scenario/templates/updated_random_strings_add.yaml.template
+++ b/functest/opnfv_tests/OpenStack/rally/scenario/templates/updated_random_strings_add.yaml.template
diff --git a/testcases/OpenStack/rally/scenario/templates/updated_random_strings_delete.yaml.template b/functest/opnfv_tests/OpenStack/rally/scenario/templates/updated_random_strings_delete.yaml.template
index d02593e3b..d02593e3b 100644
--- a/testcases/OpenStack/rally/scenario/templates/updated_random_strings_delete.yaml.template
+++ b/functest/opnfv_tests/OpenStack/rally/scenario/templates/updated_random_strings_delete.yaml.template
diff --git a/testcases/OpenStack/rally/scenario/templates/updated_random_strings_replace.yaml.template b/functest/opnfv_tests/OpenStack/rally/scenario/templates/updated_random_strings_replace.yaml.template
index 46d8bff4c..46d8bff4c 100644
--- a/testcases/OpenStack/rally/scenario/templates/updated_random_strings_replace.yaml.template
+++ b/functest/opnfv_tests/OpenStack/rally/scenario/templates/updated_random_strings_replace.yaml.template
diff --git a/testcases/OpenStack/rally/scenario/templates/updated_resource_group_increase.yaml.template b/functest/opnfv_tests/OpenStack/rally/scenario/templates/updated_resource_group_increase.yaml.template
index 891074ebc..891074ebc 100644
--- a/testcases/OpenStack/rally/scenario/templates/updated_resource_group_increase.yaml.template
+++ b/functest/opnfv_tests/OpenStack/rally/scenario/templates/updated_resource_group_increase.yaml.template
diff --git a/testcases/OpenStack/rally/scenario/templates/updated_resource_group_reduce.yaml.template b/functest/opnfv_tests/OpenStack/rally/scenario/templates/updated_resource_group_reduce.yaml.template
index b4d1d1730..b4d1d1730 100644
--- a/testcases/OpenStack/rally/scenario/templates/updated_resource_group_reduce.yaml.template
+++ b/functest/opnfv_tests/OpenStack/rally/scenario/templates/updated_resource_group_reduce.yaml.template
diff --git a/testcases/OpenStack/rally/task.yaml b/functest/opnfv_tests/OpenStack/rally/task.yaml
index c482f120d..c482f120d 100644
--- a/testcases/OpenStack/rally/task.yaml
+++ b/functest/opnfv_tests/OpenStack/rally/task.yaml
diff --git a/testcases/OpenStack/tempest/custom_tests/blacklist.txt b/functest/opnfv_tests/OpenStack/tempest/custom_tests/blacklist.txt
index 5c8581f66..5c8581f66 100644
--- a/testcases/OpenStack/tempest/custom_tests/blacklist.txt
+++ b/functest/opnfv_tests/OpenStack/tempest/custom_tests/blacklist.txt
diff --git a/testcases/OpenStack/tempest/custom_tests/defcore_req.txt b/functest/opnfv_tests/OpenStack/tempest/custom_tests/defcore_req.txt
index bb1d172df..bb1d172df 100644
--- a/testcases/OpenStack/tempest/custom_tests/defcore_req.txt
+++ b/functest/opnfv_tests/OpenStack/tempest/custom_tests/defcore_req.txt
diff --git a/testcases/OpenStack/tempest/gen_tempest_conf.py b/functest/opnfv_tests/OpenStack/tempest/gen_tempest_conf.py
index ca671d00d..ca671d00d 100755
--- a/testcases/OpenStack/tempest/gen_tempest_conf.py
+++ b/functest/opnfv_tests/OpenStack/tempest/gen_tempest_conf.py
diff --git a/testcases/OpenStack/tempest/run_tempest.py b/functest/opnfv_tests/OpenStack/tempest/run_tempest.py
index d2c01c604..d2c01c604 100755
--- a/testcases/OpenStack/tempest/run_tempest.py
+++ b/functest/opnfv_tests/OpenStack/tempest/run_tempest.py
diff --git a/testcases/OpenStack/vPing/ping.sh b/functest/opnfv_tests/OpenStack/vPing/ping.sh
index 693b86825..693b86825 100755
--- a/testcases/OpenStack/vPing/ping.sh
+++ b/functest/opnfv_tests/OpenStack/vPing/ping.sh
diff --git a/testcases/OpenStack/vPing/vping.py b/functest/opnfv_tests/OpenStack/vPing/vping.py
index 90f664568..90f664568 100755
--- a/testcases/OpenStack/vPing/vping.py
+++ b/functest/opnfv_tests/OpenStack/vPing/vping.py
diff --git a/testcases/OpenStack/vPing/vping_util.py b/functest/opnfv_tests/OpenStack/vPing/vping_util.py
index cf5a28dbd..ccd9db064 100644
--- a/testcases/OpenStack/vPing/vping_util.py
+++ b/functest/opnfv_tests/OpenStack/vPing/vping_util.py
@@ -339,7 +339,7 @@ def transfer_ping_script(ssh, floatip):
logger.info("Trying to transfer ping.sh to %s..." % floatip)
scp = SCPClient(ssh.get_transport())
- ping_script = FUNCTEST_REPO + "/testcases/OpenStack/vPing/ping.sh"
+ ping_script = FUNCTEST_REPO + "/opnfv_tests/OpenStack/vPing/ping.sh"
try:
scp.put(ping_script, "~/")
except:
diff --git a/testcases/__init__.py b/functest/opnfv_tests/__init__.py
index e69de29bb..e69de29bb 100644
--- a/testcases/__init__.py
+++ b/functest/opnfv_tests/__init__.py
diff --git a/testcases/features/copper.py b/functest/opnfv_tests/features/copper.py
index ab0162626..ab0162626 100755
--- a/testcases/features/copper.py
+++ b/functest/opnfv_tests/features/copper.py
diff --git a/testcases/features/doctor.py b/functest/opnfv_tests/features/doctor.py
index 00e5c1d6b..00e5c1d6b 100755
--- a/testcases/features/doctor.py
+++ b/functest/opnfv_tests/features/doctor.py
diff --git a/testcases/features/domino.py b/functest/opnfv_tests/features/domino.py
index 7705c07bd..7705c07bd 100755
--- a/testcases/features/domino.py
+++ b/functest/opnfv_tests/features/domino.py
diff --git a/testcases/features/multisite.py b/functest/opnfv_tests/features/multisite.py
index 6d492182c..6d492182c 100755
--- a/testcases/features/multisite.py
+++ b/functest/opnfv_tests/features/multisite.py
diff --git a/testcases/features/promise.py b/functest/opnfv_tests/features/promise.py
index cce0f5dc1..cce0f5dc1 100755
--- a/testcases/features/promise.py
+++ b/functest/opnfv_tests/features/promise.py
diff --git a/testcases/features/sfc/SSHUtils.py b/functest/opnfv_tests/features/sfc/SSHUtils.py
index 9c8c2c727..9c8c2c727 100644
--- a/testcases/features/sfc/SSHUtils.py
+++ b/functest/opnfv_tests/features/sfc/SSHUtils.py
diff --git a/testcases/features/sfc/compute_presetup_CI.bash b/functest/opnfv_tests/features/sfc/compute_presetup_CI.bash
index 36148aa15..36148aa15 100755
--- a/testcases/features/sfc/compute_presetup_CI.bash
+++ b/functest/opnfv_tests/features/sfc/compute_presetup_CI.bash
diff --git a/testcases/features/sfc/correct_classifier.bash b/functest/opnfv_tests/features/sfc/correct_classifier.bash
index fb08af5c1..fb08af5c1 100755
--- a/testcases/features/sfc/correct_classifier.bash
+++ b/functest/opnfv_tests/features/sfc/correct_classifier.bash
diff --git a/testcases/features/sfc/delete.sh b/functest/opnfv_tests/features/sfc/delete.sh
index c04ae6375..c04ae6375 100755
--- a/testcases/features/sfc/delete.sh
+++ b/functest/opnfv_tests/features/sfc/delete.sh
diff --git a/testcases/features/sfc/ovs_utils.py b/functest/opnfv_tests/features/sfc/ovs_utils.py
index 29eed3844..af1f232c8 100644
--- a/testcases/features/sfc/ovs_utils.py
+++ b/functest/opnfv_tests/features/sfc/ovs_utils.py
@@ -11,6 +11,7 @@ import functest.utils.functest_logger as rl
import os
import time
import shutil
+import re
logger = rl.Logger('ovs_utils').getLogger()
@@ -18,7 +19,7 @@ logger = rl.Logger('ovs_utils').getLogger()
class OVSLogger(object):
def __init__(self, basedir, ft_resdir):
self.ovs_dir = basedir
- self.ft.resdir = ft_resdir
+ self.ft_resdir = ft_resdir
self.__mkdir_p(self.ovs_dir)
def __mkdir_p(self, dirpath):
@@ -115,3 +116,22 @@ class OVSLogger(object):
dumpdir = os.path.join(self.ovs_dir, timestamp)
with open(os.path.join(dumpdir, 'error'), 'w') as f:
f.write(related_error)
+
+ def ofctl_time_counter(self, ssh_conn):
+ try:
+ # We get the flows from table 11
+ table = 11
+ br = "br-int"
+ output = self.ofctl_dump_flows(ssh_conn, br, table)
+ pattern = "NXM_NX_NSP"
+ rsps = []
+ lines = output.split(",")
+ for line in lines:
+ is_there = re.findall(pattern, line)
+ if is_there:
+ value = line.split(":")[1].split("-")[0]
+ rsps.append(value)
+ return rsps
+ except Exception, e:
+ logger.error('Error when countering %s' % e)
+ return None
diff --git a/testcases/features/sfc/prepare_odl_sfc.bash b/functest/opnfv_tests/features/sfc/prepare_odl_sfc.bash
index 80ed9bd92..c4d8f4f81 100755
--- a/testcases/features/sfc/prepare_odl_sfc.bash
+++ b/functest/opnfv_tests/features/sfc/prepare_odl_sfc.bash
@@ -13,7 +13,7 @@
#
ODL_SFC_LOG=/home/opnfv/functest/results/odl-sfc.log
-ODL_SFC_DIR=${FUNCTEST_REPO_DIR}/testcases/features/sfc
+ODL_SFC_DIR=${FUNCTEST_REPO_DIR}/opnfv_tests/features/sfc
# Split the output to the log file and redirect STDOUT and STDERR to /dev/null
bash ${ODL_SFC_DIR}/server_presetup_CI.bash |& \
diff --git a/testcases/features/sfc/prepare_odl_sfc.py b/functest/opnfv_tests/features/sfc/prepare_odl_sfc.py
index 78f4d7646..3d700b8a7 100755
--- a/testcases/features/sfc/prepare_odl_sfc.py
+++ b/functest/opnfv_tests/features/sfc/prepare_odl_sfc.py
@@ -33,7 +33,7 @@ except:
INSTALLER_IP = "10.20.0.2"
os.environ['ODL_SFC_LOG'] = "/home/opnfv/functest/results/odl-sfc.log"
-os.environ['ODL_SFC_DIR'] = FUNCTEST_REPO_DIR + "/testcases/features/sfc"
+os.environ['ODL_SFC_DIR'] = FUNCTEST_REPO_DIR + "/opnfv_tests/features/sfc"
command = os.environ['ODL_SFC_DIR'] + ("/server_presetup_CI.bash | "
"tee -a ${ODL_SFC_LOG} "
diff --git a/testcases/features/sfc/server_presetup_CI.bash b/functest/opnfv_tests/features/sfc/server_presetup_CI.bash
index 240353f5b..240353f5b 100755
--- a/testcases/features/sfc/server_presetup_CI.bash
+++ b/functest/opnfv_tests/features/sfc/server_presetup_CI.bash
diff --git a/functest/opnfv_tests/features/sfc/sfc.py b/functest/opnfv_tests/features/sfc/sfc.py
new file mode 100755
index 000000000..32cd2d256
--- /dev/null
+++ b/functest/opnfv_tests/features/sfc/sfc.py
@@ -0,0 +1,585 @@
+import argparse
+import os
+import subprocess
+import sys
+import time
+import functest.utils.functest_logger as ft_logger
+import functest.utils.functest_utils as ft_utils
+import functest.utils.openstack_utils as os_utils
+import re
+import json
+import SSHUtils as ssh_utils
+import ovs_utils
+import thread
+
+parser = argparse.ArgumentParser()
+
+parser.add_argument("-r", "--report",
+ help="Create json result file",
+ action="store_true")
+
+args = parser.parse_args()
+
+""" logging configuration """
+logger = ft_logger.Logger("ODL_SFC").getLogger()
+
+FUNCTEST_RESULTS_DIR = '/home/opnfv/functest/results/odl-sfc'
+FUNCTEST_REPO = ft_utils.FUNCTEST_REPO
+REPO_PATH = os.environ['repos_dir'] + '/functest/'
+HOME = os.environ['HOME'] + "/"
+CLIENT = "client"
+SERVER = "server"
+FLAVOR = "custom"
+IMAGE_NAME = "sf_nsh_colorado"
+IMAGE_FILENAME = "sf_nsh_colorado.qcow2"
+IMAGE_FORMAT = "qcow2"
+IMAGE_DIR = "/home/opnfv/functest/data"
+IMAGE_PATH = IMAGE_DIR + "/" + IMAGE_FILENAME
+IMAGE_URL = "http://artifacts.opnfv.org/sfc/demo/" + IMAGE_FILENAME
+
+# NEUTRON Private Network parameters
+NET_NAME = "example-net"
+SUBNET_NAME = "example-subnet"
+SUBNET_CIDR = "11.0.0.0/24"
+ROUTER_NAME = "example-router"
+SECGROUP_NAME = "example-sg"
+SECGROUP_DESCR = "Example Security group"
+SFC_TEST_DIR = REPO_PATH + "/opnfv_tests/features/sfc/"
+TACKER_SCRIPT = SFC_TEST_DIR + "sfc_tacker.bash"
+TACKER_CHANGECLASSI = SFC_TEST_DIR + "sfc_change_classi.bash"
+ssh_options = '-q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no'
+json_results = {"tests": 4, "failures": 0}
+
+PROXY = {
+ 'ip': '10.20.0.2',
+ 'username': 'root',
+ 'password': 'r00tme'
+}
+
+# run given command locally and return commands output if success
+
+
+def run_cmd(cmd, wdir=None, ignore_stderr=False, ignore_no_output=True):
+ pipe = subprocess.Popen(cmd, shell=True,
+ stdin=subprocess.PIPE,
+ stdout=subprocess.PIPE,
+ stderr=subprocess.PIPE, cwd=wdir)
+
+ (output, errors) = pipe.communicate()
+ if output:
+ output = output.strip()
+ if pipe.returncode < 0:
+ logger.error(errors)
+ return False
+ if errors:
+ logger.error(errors)
+ if ignore_stderr:
+ return True
+ else:
+ return False
+
+ if ignore_no_output:
+ if not output:
+ return True
+
+ return output
+
+# run given command on OpenStack controller
+
+
+def run_cmd_on_cntlr(cmd):
+ ip_cntlrs = get_openstack_node_ips("controller")
+ if not ip_cntlrs:
+ return None
+
+ ssh_cmd = "ssh %s %s %s" % (ssh_options, ip_cntlrs[0], cmd)
+ return run_cmd_on_fm(ssh_cmd)
+
+# run given command on OpenStack Compute node
+
+
+def run_cmd_on_compute(cmd):
+ ip_computes = get_openstack_node_ips("compute")
+ if not ip_computes:
+ return None
+
+ ssh_cmd = "ssh %s %s %s" % (ssh_options, ip_computes[0], cmd)
+ return run_cmd_on_fm(ssh_cmd)
+
+# run given command on Fuel Master
+
+
+def run_cmd_on_fm(cmd, username="root", passwd="r00tme"):
+ ip = os.environ.get("INSTALLER_IP")
+ ssh_cmd = "sshpass -p %s ssh %s %s@%s %s" % (
+ passwd, ssh_options, username, ip, cmd)
+ return run_cmd(ssh_cmd)
+
+# run given command on Remote Machine, Can be VM
+
+
+def run_cmd_remote(ip, cmd, username="root", passwd="opnfv"):
+ ssh_opt_append = "%s -o ConnectTimeout=50 " % ssh_options
+ ssh_cmd = "sshpass -p %s ssh %s %s@%s %s" % (
+ passwd, ssh_opt_append, username, ip, cmd)
+ return run_cmd(ssh_cmd)
+
+# Get OpenStack Nodes IP Address
+
+
+def get_openstack_node_ips(role):
+ fuel_env = os.environ.get("FUEL_ENV")
+ if fuel_env is not None:
+ cmd = "fuel2 node list -f json -e %s" % fuel_env
+ else:
+ cmd = "fuel2 node list -f json"
+
+ nodes = run_cmd_on_fm(cmd)
+ ips = []
+ nodes = json.loads(nodes)
+ for node in nodes:
+ if role in node["roles"]:
+ ips.append(node["ip"])
+
+ return ips
+
+# Configures IPTABLES on OpenStack Controller
+
+
+def configure_iptables():
+ iptable_cmds = ["iptables -P INPUT ACCEPT",
+ "iptables -t nat -P INPUT ACCEPT",
+ "iptables -A INPUT -m state \
+ --state NEW,ESTABLISHED,RELATED -j ACCEPT"]
+
+ for cmd in iptable_cmds:
+ logger.info("Configuring %s on contoller" % cmd)
+ run_cmd_on_cntlr(cmd)
+
+ return
+
+
+def download_image():
+ if not os.path.isfile(IMAGE_PATH):
+ logger.info("Downloading image")
+ ft_utils.download_url(IMAGE_URL, IMAGE_DIR)
+
+ logger.info("Using old image")
+ return
+
+
+def setup_glance(glance_client):
+ image_id = os_utils.create_glance_image(glance_client,
+ IMAGE_NAME,
+ IMAGE_PATH,
+ disk=IMAGE_FORMAT,
+ container="bare",
+ public=True)
+
+ return image_id
+
+
+def setup_neutron(neutron_client):
+ n_dict = os_utils.create_network_full(neutron_client,
+ NET_NAME,
+ SUBNET_NAME,
+ ROUTER_NAME,
+ SUBNET_CIDR)
+ if not n_dict:
+ logger.error("failed to create neutron network")
+ sys.exit(-1)
+
+ network_id = n_dict["net_id"]
+ return network_id
+
+
+def setup_ingress_egress_secgroup(neutron_client, protocol,
+ min_port=None, max_port=None):
+ secgroups = os_utils.get_security_groups(neutron_client)
+ for sg in secgroups:
+ os_utils.create_secgroup_rule(neutron_client, sg['id'],
+ 'ingress', protocol,
+ port_range_min=min_port,
+ port_range_max=max_port)
+ os_utils.create_secgroup_rule(neutron_client, sg['id'],
+ 'egress', protocol,
+ port_range_min=min_port,
+ port_range_max=max_port)
+ return
+
+
+def setup_security_groups(neutron_client):
+ sg_id = os_utils.create_security_group_full(neutron_client,
+ SECGROUP_NAME, SECGROUP_DESCR)
+ setup_ingress_egress_secgroup(neutron_client, "icmp")
+ setup_ingress_egress_secgroup(neutron_client, "udp", 67, 68)
+ setup_ingress_egress_secgroup(neutron_client, "tcp", 22, 22)
+ setup_ingress_egress_secgroup(neutron_client, "tcp", 80, 80)
+ return sg_id
+
+
+def boot_instance(nova_client, name, flavor, image_id, network_id, sg_id):
+ logger.info("Creating instance '%s'..." % name)
+ logger.debug(
+ "Configuration:\n name=%s \n flavor=%s \n image=%s \n "
+ "network=%s \n" % (name, flavor, image_id, network_id))
+
+ instance = os_utils.create_instance_and_wait_for_active(flavor,
+ image_id,
+ network_id,
+ name)
+
+ if instance is None:
+ logger.error("Error while booting instance.")
+ sys.exit(-1)
+
+ instance_ip = instance.networks.get(NET_NAME)[0]
+ logger.debug("Instance '%s' got private ip '%s'." %
+ (name, instance_ip))
+
+ logger.info("Adding '%s' to security group %s" % (name, SECGROUP_NAME))
+ os_utils.add_secgroup_to_instance(nova_client, instance.id, sg_id)
+
+ return instance_ip
+
+
+def ping(remote, pkt_cnt=1, iface=None, retries=100, timeout=None):
+ ping_cmd = 'ping'
+
+ if timeout:
+ ping_cmd = ping_cmd + ' -w %s' % timeout
+
+ grep_cmd = "grep -e 'packet loss' -e rtt"
+
+ if iface is not None:
+ ping_cmd = ping_cmd + ' -I %s' % iface
+
+ ping_cmd = ping_cmd + ' -i 0 -c %d %s' % (pkt_cnt, remote)
+ cmd = ping_cmd + '|' + grep_cmd
+
+ while retries > 0:
+ output = run_cmd(cmd)
+ if not output:
+ return False
+
+ match = re.search('(\d*)% packet loss', output)
+ if not match:
+ return False
+
+ packet_loss = int(match.group(1))
+ if packet_loss == 0:
+ return True
+
+ retries = retries - 1
+
+ return False
+
+
+def get_floating_ips(nova_client, neutron_client):
+ ips = []
+ instances = nova_client.servers.list(search_opts={'all_tenants': 1})
+ for instance in instances:
+ floatip_dic = os_utils.create_floating_ip(neutron_client)
+ floatip = floatip_dic['fip_addr']
+ instance.add_floating_ip(floatip)
+ logger.info("Instance name and ip %s:%s " % (instance.name, floatip))
+ logger.info("Waiting for instance %s:%s to come up" %
+ (instance.name, floatip))
+ if not ping(floatip):
+ logger.info("Instance %s:%s didn't come up" %
+ (instance.name, floatip))
+ sys.exit(1)
+
+ if instance.name == "server":
+ logger.info("Server:%s is reachable" % floatip)
+ server_ip = floatip
+ elif instance.name == "client":
+ logger.info("Client:%s is reachable" % floatip)
+ client_ip = floatip
+ else:
+ logger.info("SF:%s is reachable" % floatip)
+ ips.append(floatip)
+
+ return server_ip, client_ip, ips[1], ips[0]
+
+# Start http server on a give machine, Can be VM
+
+
+def start_http_server(ip):
+ cmd = "\'python -m SimpleHTTPServer 80"
+ cmd = cmd + " > /dev/null 2>&1 &\'"
+ return run_cmd_remote(ip, cmd)
+
+# Set firewall using vxlan_tool.py on a give machine, Can be VM
+
+
+def vxlan_firewall(sf, iface="eth0", port="22", block=True):
+ cmd = "python vxlan_tool.py"
+ cmd = cmd + " -i " + iface + " -d forward -v off"
+ if block:
+ cmd = "python vxlan_tool.py -i eth0 -d forward -v off -b " + port
+
+ cmd = "sh -c 'cd /root;nohup " + cmd + " > /dev/null 2>&1 &'"
+ run_cmd_remote(sf, cmd)
+
+# Run netcat on a give machine, Can be VM
+
+
+def netcat(s_ip, c_ip, port="80", timeout=5):
+ cmd = "nc -zv "
+ cmd = cmd + " -w %s %s %s" % (timeout, s_ip, port)
+ cmd = cmd + " 2>&1"
+ output = run_cmd_remote(c_ip, cmd)
+ logger.info("%s" % output)
+ return output
+
+
+def is_ssh_blocked(srv_prv_ip, client_ip):
+ res = netcat(srv_prv_ip, client_ip, port="22")
+ match = re.search("nc:.*timed out:.*", res, re.M)
+ if match:
+ return True
+
+ return False
+
+
+def is_http_blocked(srv_prv_ip, client_ip):
+ res = netcat(srv_prv_ip, client_ip, port="80")
+ match = re.search(".* 80 port.* succeeded!", res, re.M)
+ if match:
+ return False
+
+ return True
+
+
+def capture_err_logs(controller_clients, compute_clients, error):
+ ovs_logger = ovs_utils.OVSLogger(
+ os.path.join(os.getcwd(), 'ovs-logs'),
+ FUNCTEST_RESULTS_DIR)
+
+ timestamp = time.strftime("%Y%m%d-%H%M%S")
+ ovs_logger.dump_ovs_logs(controller_clients,
+ compute_clients,
+ related_error=error,
+ timestamp=timestamp)
+ return
+
+
+def update_json_results(name, result):
+ json_results.update({name: result})
+ if result is not "Passed":
+ json_results["failures"] += 1
+
+ return
+
+
+def get_ssh_clients(role):
+ clients = []
+ for ip in get_openstack_node_ips(role):
+ s_client = ssh_utils.get_ssh_client(ip,
+ 'root',
+ proxy=PROXY)
+ clients.append(s_client)
+
+ return clients
+
+# Check SSH connectivity to VNFs
+
+
+def check_ssh(ips, retries=100):
+ check = [False, False]
+ logger.info("Checking SSH connectivity to the SFs with ips %s" % str(ips))
+ while retries and not all(check):
+ for index, ip in enumerate(ips):
+ check[index] = run_cmd_remote(ip, "exit")
+
+ if all(check):
+ logger.info("SSH connectivity to the SFs established")
+ return True
+
+ time.sleep(3)
+ retries -= 1
+
+ return False
+
+# Measure the time it takes to update the classification rules
+
+
+def capture_time_log(compute_clients):
+ ovs_logger = ovs_utils.OVSLogger(
+ os.path.join(os.getcwd(), 'ovs-logs'),
+ "test")
+ i = 0
+ first_RSP = ""
+ start_time = time.time()
+ while True:
+ rsps = ovs_logger.ofctl_time_counter(compute_clients[0])
+ if not i:
+ first_RSP = rsps[0]
+ i = i + 1
+ if(first_RSP != rsps[0]):
+ if (rsps[0] == rsps[1]):
+ stop_time = time.time()
+ logger.info("classification rules updated")
+ difference = stop_time - start_time
+ logger.info("It took %s seconds" % difference)
+ break
+ time.sleep(1)
+ return
+
+
+def main():
+ installer_type = os.environ.get("INSTALLER_TYPE")
+ if installer_type != "fuel":
+ logger.error(
+ '\033[91mCurrently supported only Fuel Installer type\033[0m')
+ sys.exit(1)
+
+ installer_ip = os.environ.get("INSTALLER_IP")
+ if not installer_ip:
+ logger.error(
+ '\033[91minstaller ip is not set\033[0m')
+ logger.error(
+ '\033[91mexport INSTALLER_IP=<ip>\033[0m')
+ sys.exit(1)
+
+ env_list = run_cmd_on_fm("fuel2 env list -f json")
+ fuel_env = os.environ.get("FUEL_ENV")
+ if len(eval(env_list)) > 1 and fuel_env is None:
+ out = run_cmd_on_fm("fuel env")
+ logger.error(
+ '\033[91mMore than one fuel env found\033[0m\n %s' % out)
+ logger.error(
+ '\033[91mexport FUEL_ENV=<env-id> to set ENV\033[0m')
+ sys.exit(1)
+
+ start_time = time.time()
+ status = "PASS"
+ configure_iptables()
+ download_image()
+ _, custom_flv_id = os_utils.get_or_create_flavor(
+ FLAVOR, 1500, 10, 1, public=True)
+ if not custom_flv_id:
+ logger.error("Failed to create custom flavor")
+ sys.exit(1)
+
+ glance_client = os_utils.get_glance_client()
+ neutron_client = os_utils.get_neutron_client()
+ nova_client = os_utils.get_nova_client()
+
+ controller_clients = get_ssh_clients("controller")
+ compute_clients = get_ssh_clients("compute")
+
+ image_id = setup_glance(glance_client)
+ network_id = setup_neutron(neutron_client)
+ sg_id = setup_security_groups(neutron_client)
+
+ boot_instance(
+ nova_client, CLIENT, FLAVOR, image_id, network_id, sg_id)
+ srv_prv_ip = boot_instance(
+ nova_client, SERVER, FLAVOR, image_id, network_id, sg_id)
+
+ subprocess.call(TACKER_SCRIPT, shell=True)
+
+ # Start measuring the time it takes to implement the classification rules
+ try:
+ thread.start_new_thread(capture_time_log, (compute_clients,))
+ except Exception, e:
+ logger.error("Unable to start the thread that counts time %s" % e)
+
+ server_ip, client_ip, sf1, sf2 = get_floating_ips(
+ nova_client, neutron_client)
+
+ if not check_ssh([sf1, sf2]):
+ logger.error("Cannot establish SSH connection to the SFs")
+ sys.exit(1)
+
+ logger.info("Starting HTTP server on %s" % server_ip)
+ if not start_http_server(server_ip):
+ logger.error(
+ '\033[91mFailed to start HTTP server on %s\033[0m' % server_ip)
+ sys.exit(1)
+
+ logger.info("Starting HTTP firewall on %s" % sf2)
+ vxlan_firewall(sf2, port="80")
+ logger.info("Starting SSH firewall on %s" % sf1)
+ vxlan_firewall(sf1, port="22")
+
+ logger.info("Wait for ODL to update the classification rules in OVS")
+ time.sleep(120)
+
+ logger.info("Test SSH")
+ if is_ssh_blocked(srv_prv_ip, client_ip):
+ logger.info('\033[92mTEST 1 [PASSED] ==> SSH BLOCKED\033[0m')
+ update_json_results("Test 1: SSH Blocked", "Passed")
+ else:
+ error = ('\033[91mTEST 1 [FAILED] ==> SSH NOT BLOCKED\033[0m')
+ logger.error(error)
+ capture_err_logs(controller_clients, compute_clients, error)
+ update_json_results("Test 1: SSH Blocked", "Failed")
+
+ logger.info("Test HTTP")
+ if not is_http_blocked(srv_prv_ip, client_ip):
+ logger.info('\033[92mTEST 2 [PASSED] ==> HTTP WORKS\033[0m')
+ update_json_results("Test 2: HTTP works", "Passed")
+ else:
+ error = ('\033[91mTEST 2 [FAILED] ==> HTTP BLOCKED\033[0m')
+ logger.error(error)
+ capture_err_logs(controller_clients, compute_clients, error)
+ update_json_results("Test 2: HTTP works", "Failed")
+
+ logger.info("Changing the classification")
+ subprocess.call(TACKER_CHANGECLASSI, shell=True)
+
+ # Start measuring the time it takes to implement the classification rules
+ try:
+ thread.start_new_thread(capture_time_log, (compute_clients,))
+ except Exception, e:
+ logger.error("Unable to start the thread that counts time %s" % e)
+
+ logger.info("Wait for ODL to update the classification rules in OVS")
+ time.sleep(100)
+
+ logger.info("Test HTTP")
+ if is_http_blocked(srv_prv_ip, client_ip):
+ logger.info('\033[92mTEST 3 [PASSED] ==> HTTP Blocked\033[0m')
+ update_json_results("Test 3: HTTP Blocked", "Passed")
+ else:
+ error = ('\033[91mTEST 3 [FAILED] ==> HTTP WORKS\033[0m')
+ logger.error(error)
+ capture_err_logs(controller_clients, compute_clients, error)
+ update_json_results("Test 3: HTTP Blocked", "Failed")
+
+ logger.info("Test SSH")
+ if not is_ssh_blocked(srv_prv_ip, client_ip):
+ logger.info('\033[92mTEST 4 [PASSED] ==> SSH Works\033[0m')
+ update_json_results("Test 4: SSH Works", "Passed")
+ else:
+ error = ('\033[91mTEST 4 [FAILED] ==> SSH BLOCKED\033[0m')
+ logger.error(error)
+ capture_err_logs(controller_clients, compute_clients, error)
+ update_json_results("Test 4: SSH Works", "Failed")
+
+ if json_results["failures"]:
+ status = "FAIL"
+ logger.error('\033[91mSFC TESTS: %s :( FOUND %s FAIL \033[0m' % (
+ status, json_results["failures"]))
+
+ if args.report:
+ stop_time = time.time()
+ logger.debug("Promise Results json: " + str(json_results))
+ ft_utils.push_results_to_db("sfc",
+ "functest-odl-sfc",
+ start_time,
+ stop_time,
+ status,
+ json_results)
+
+ if status == "PASS":
+ logger.info('\033[92mSFC ALL TESTS: %s :)\033[0m' % status)
+ sys.exit(0)
+
+ sys.exit(1)
+
+if __name__ == '__main__':
+ main()
diff --git a/testcases/features/sfc/sfc_change_classi.bash b/functest/opnfv_tests/features/sfc/sfc_change_classi.bash
index 70375ab3b..70375ab3b 100755
--- a/testcases/features/sfc/sfc_change_classi.bash
+++ b/functest/opnfv_tests/features/sfc/sfc_change_classi.bash
diff --git a/testcases/features/sfc/sfc_colorado1.py b/functest/opnfv_tests/features/sfc/sfc_colorado1.py
index 8dd6c808e..6965f283a 100755
--- a/testcases/features/sfc/sfc_colorado1.py
+++ b/functest/opnfv_tests/features/sfc/sfc_colorado1.py
@@ -175,6 +175,14 @@ def main():
for sg in secgroups:
os_utils.create_secgroup_rule(neutron_client, sg['id'],
+ 'ingress', 'udp',
+ port_range_min=67,
+ port_range_max=68)
+ os_utils.create_secgroup_rule(neutron_client, sg['id'],
+ 'egress', 'udp',
+ port_range_min=67,
+ port_range_max=68)
+ os_utils.create_secgroup_rule(neutron_client, sg['id'],
'ingress', 'tcp',
port_range_min=22,
port_range_max=22)
@@ -294,7 +302,7 @@ def main():
# CREATION OF THE 2 SF ####
- tacker_script = "%s/testcases/features/sfc/%s" % \
+ tacker_script = "%s/opnfv_tests/features/sfc/%s" % \
(FUNCTEST_REPO, TACKER_SCRIPT)
logger.info("Executing tacker script: '%s'" % tacker_script)
subprocess.call(tacker_script, shell=True)
@@ -423,6 +431,7 @@ def main():
# SSH TO EXECUTE cmd_client
logger.info("TEST STARTED")
+ time.sleep(70)
try:
ssh.connect(floatip_client, username="root",
password="opnfv", timeout=2)
@@ -483,7 +492,7 @@ def main():
# CHANGE OF CLASSIFICATION #
logger.info("Changing the classification")
- tacker_classi = "%s/testcases/features/sfc/%s" % \
+ tacker_classi = "%s/opnfv_tests/features/sfc/%s" % \
(FUNCTEST_REPO, TACKER_CHANGECLASSI)
subprocess.call(tacker_classi, shell=True)
@@ -559,7 +568,7 @@ def main():
break
else:
logger.info("Iterating again!")
- delete = "bash %s/testcases/features/sfc/delete.sh" % \
+ delete = "bash %s/opnfv_tests/features/sfc/delete.sh" % \
(FUNCTEST_REPO)
try:
subprocess.call(delete, shell=True, stderr=subprocess.PIPE)
diff --git a/testcases/features/sfc/sfc_tacker.bash b/functest/opnfv_tests/features/sfc/sfc_tacker.bash
index 690d5f52e..690d5f52e 100755
--- a/testcases/features/sfc/sfc_tacker.bash
+++ b/functest/opnfv_tests/features/sfc/sfc_tacker.bash
diff --git a/testcases/features/sfc/tacker_client_install.sh b/functest/opnfv_tests/features/sfc/tacker_client_install.sh
index a3073177c..adb9a44be 100755
--- a/testcases/features/sfc/tacker_client_install.sh
+++ b/functest/opnfv_tests/features/sfc/tacker_client_install.sh
@@ -21,7 +21,7 @@ ____EOF
function envSetup() {
apt-get install -y python-all debhelper fakeroot
- pip install --upgrade python-keystoneclient==1.7.4
+ #pip install --upgrade python-keystoneclient==1.7.4
chkPPkg stdeb
}
diff --git a/testcases/features/sfc/test-vnfd1.yaml b/functest/opnfv_tests/features/sfc/test-vnfd1.yaml
index 5c672e388..5c672e388 100644
--- a/testcases/features/sfc/test-vnfd1.yaml
+++ b/functest/opnfv_tests/features/sfc/test-vnfd1.yaml
diff --git a/testcases/features/sfc/test-vnfd2.yaml b/functest/opnfv_tests/features/sfc/test-vnfd2.yaml
index 8a570ab92..8a570ab92 100644
--- a/testcases/features/sfc/test-vnfd2.yaml
+++ b/functest/opnfv_tests/features/sfc/test-vnfd2.yaml
diff --git a/testcases/security_scan/config.ini b/functest/opnfv_tests/security_scan/config.ini
index b97de80fa..b97de80fa 100644
--- a/testcases/security_scan/config.ini
+++ b/functest/opnfv_tests/security_scan/config.ini
diff --git a/testcases/security_scan/connect.py b/functest/opnfv_tests/security_scan/connect.py
index 18ca96d80..18ca96d80 100644
--- a/testcases/security_scan/connect.py
+++ b/functest/opnfv_tests/security_scan/connect.py
diff --git a/testcases/security_scan/examples/xccdf-rhel7-server-upstream.ini b/functest/opnfv_tests/security_scan/examples/xccdf-rhel7-server-upstream.ini
index 43b2e82d6..43b2e82d6 100644
--- a/testcases/security_scan/examples/xccdf-rhel7-server-upstream.ini
+++ b/functest/opnfv_tests/security_scan/examples/xccdf-rhel7-server-upstream.ini
diff --git a/testcases/security_scan/examples/xccdf-standard.ini b/functest/opnfv_tests/security_scan/examples/xccdf-standard.ini
index bfbcf82d3..bfbcf82d3 100644
--- a/testcases/security_scan/examples/xccdf-standard.ini
+++ b/functest/opnfv_tests/security_scan/examples/xccdf-standard.ini
diff --git a/testcases/security_scan/scripts/createfiles.py b/functest/opnfv_tests/security_scan/scripts/createfiles.py
index b828901a5..b828901a5 100644
--- a/testcases/security_scan/scripts/createfiles.py
+++ b/functest/opnfv_tests/security_scan/scripts/createfiles.py
diff --git a/testcases/security_scan/scripts/internet_check.py b/functest/opnfv_tests/security_scan/scripts/internet_check.py
index 1bed50a70..1bed50a70 100644
--- a/testcases/security_scan/scripts/internet_check.py
+++ b/functest/opnfv_tests/security_scan/scripts/internet_check.py
diff --git a/testcases/security_scan/security_scan.py b/functest/opnfv_tests/security_scan/security_scan.py
index 98e6b7a8c..4e0407fba 100755
--- a/testcases/security_scan/security_scan.py
+++ b/functest/opnfv_tests/security_scan/security_scan.py
@@ -33,7 +33,7 @@ __url__ = 'https://wiki.opnfv.org/display/functest/Functest+Security'
# Global vars
INSTALLER_IP = os.getenv('INSTALLER_IP')
oscapbin = 'sudo /bin/oscap'
-functest_dir = '%s/testcases/security_scan/' % ft_utils.FUNCTEST_REPO
+functest_dir = '%s/opnfv_tests/security_scan/' % ft_utils.FUNCTEST_REPO
# Apex Spefic var needed to query Undercloud
if os.getenv('OS_AUTH_URL') is None:
diff --git a/testcases/vnf/vIMS/clearwater.py b/functest/opnfv_tests/vnf/vIMS/clearwater.py
index 7236f4fba..7236f4fba 100644
--- a/testcases/vnf/vIMS/clearwater.py
+++ b/functest/opnfv_tests/vnf/vIMS/clearwater.py
diff --git a/testcases/vnf/vIMS/create_venv.sh b/functest/opnfv_tests/vnf/vIMS/create_venv.sh
index 575fd177c..575fd177c 100755
--- a/testcases/vnf/vIMS/create_venv.sh
+++ b/functest/opnfv_tests/vnf/vIMS/create_venv.sh
diff --git a/testcases/vnf/vIMS/orchestrator.py b/functest/opnfv_tests/vnf/vIMS/orchestrator.py
index 61157a4fb..61157a4fb 100644
--- a/testcases/vnf/vIMS/orchestrator.py
+++ b/functest/opnfv_tests/vnf/vIMS/orchestrator.py
diff --git a/testcases/vnf/vIMS/requirements.pip b/functest/opnfv_tests/vnf/vIMS/requirements.pip
index ab26f6e02..ab26f6e02 100644
--- a/testcases/vnf/vIMS/requirements.pip
+++ b/functest/opnfv_tests/vnf/vIMS/requirements.pip
diff --git a/testcases/vnf/vIMS/vIMS.py b/functest/opnfv_tests/vnf/vIMS/vIMS.py
index 50aa715f4..50aa715f4 100755
--- a/testcases/vnf/vIMS/vIMS.py
+++ b/functest/opnfv_tests/vnf/vIMS/vIMS.py
diff --git a/testcases/vnf/vRNC/parser.py b/functest/opnfv_tests/vnf/vRNC/parser.py
index 0381fd648..0381fd648 100755
--- a/testcases/vnf/vRNC/parser.py
+++ b/functest/opnfv_tests/vnf/vRNC/parser.py
diff --git a/unit_tests/__init__.py b/functest/tests/__init__.py
index e69de29bb..e69de29bb 100644
--- a/unit_tests/__init__.py
+++ b/functest/tests/__init__.py
diff --git a/unit_tests/core/__init__.py b/functest/tests/unit/__init__.py
index e69de29bb..e69de29bb 100644
--- a/unit_tests/core/__init__.py
+++ b/functest/tests/unit/__init__.py
diff --git a/unit_tests/odl/__init__.py b/functest/tests/unit/core/__init__.py
index e69de29bb..e69de29bb 100644
--- a/unit_tests/odl/__init__.py
+++ b/functest/tests/unit/core/__init__.py
diff --git a/unit_tests/core/test_base.py b/functest/tests/unit/core/test_base.py
index 25faca0aa..25faca0aa 100644
--- a/unit_tests/core/test_base.py
+++ b/functest/tests/unit/core/test_base.py
diff --git a/utils/__init__.py b/functest/tests/unit/odl/__init__.py
index e69de29bb..e69de29bb 100644
--- a/utils/__init__.py
+++ b/functest/tests/unit/odl/__init__.py
diff --git a/unit_tests/odl/test_odl.py b/functest/tests/unit/odl/test_odl.py
index 76732593e..3f33dc88e 100644
--- a/unit_tests/odl/test_odl.py
+++ b/functest/tests/unit/odl/test_odl.py
@@ -16,7 +16,7 @@ import unittest
from robot.errors import RobotError
from functest.core import TestCasesBase
-from functest.testcases.Controllers.ODL import OpenDaylightTesting
+from functest.opnfv_tests.Controllers.ODL import OpenDaylightTesting
class ODLTestCasesTesting(unittest.TestCase):
@@ -43,19 +43,6 @@ class ODLTestCasesTesting(unittest.TestCase):
os.environ["OS_TENANT_NAME"] = self._os_tenantname
self.test = OpenDaylightTesting.ODLTestCases()
- @mock.patch('shutil.copy', side_effect=Exception())
- def test_copy_opnf_testcases_exception(self, *args):
- with self.assertRaises(Exception):
- self.test.copy_opnf_testcases()
-
- @mock.patch('shutil.copy', side_effect=IOError())
- def test_copy_opnf_testcases_ioerror(self, *args):
- self.assertFalse(self.test.copy_opnf_testcases())
-
- @mock.patch('shutil.copy')
- def test_copy_opnf_testcases(self, *args):
- self.assertTrue(self.test.copy_opnf_testcases())
-
@mock.patch('fileinput.input', side_effect=Exception())
def test_set_robotframework_vars_failed(self, *args):
self.assertFalse(self.test.set_robotframework_vars())
@@ -159,57 +146,41 @@ class ODLTestCasesTesting(unittest.TestCase):
def test_main_missing_odlrestconfport(self):
self._test_main_missing_keyword('odlrestconfport')
- def test_main_copy_opnf_testcases_failed(self):
- with mock.patch.object(self.test, 'copy_opnf_testcases',
- return_value=False):
- self._test_main(TestCasesBase.TestCasesBase.EX_RUN_ERROR)
- self.test.copy_opnf_testcases.assert_called_once_with()
-
def test_main_set_robotframework_vars_failed(self):
- with mock.patch.object(self.test, 'copy_opnf_testcases',
- return_value=True), \
- mock.patch.object(self.test, 'set_robotframework_vars',
- return_value=False):
+ with mock.patch.object(self.test, 'set_robotframework_vars',
+ return_value=False):
self._test_main(TestCasesBase.TestCasesBase.EX_RUN_ERROR)
self.test.set_robotframework_vars.assert_called_once_with(
self._odl_username, self._odl_password)
@mock.patch('os.makedirs', side_effect=Exception)
def test_main_makedirs_exception(self, mock_method):
- with mock.patch.object(self.test,
- 'copy_opnf_testcases', return_value=True), \
- mock.patch.object(self.test, 'set_robotframework_vars',
- return_value=True), \
+ with mock.patch.object(self.test, 'set_robotframework_vars',
+ return_value=True), \
self.assertRaises(Exception):
self._test_main(TestCasesBase.TestCasesBase.EX_RUN_ERROR,
mock_method)
@mock.patch('os.makedirs', side_effect=OSError)
def test_main_makedirs_oserror(self, mock_method):
- with mock.patch.object(self.test,
- 'copy_opnf_testcases', return_value=True), \
- mock.patch.object(self.test, 'set_robotframework_vars',
- return_value=True):
+ with mock.patch.object(self.test, 'set_robotframework_vars',
+ return_value=True):
self._test_main(TestCasesBase.TestCasesBase.EX_RUN_ERROR,
mock_method)
@mock.patch('robot.run', side_effect=RobotError)
@mock.patch('os.makedirs')
def test_main_robot_run_failed(self, *args):
- with mock.patch.object(self.test, 'copy_opnf_testcases',
+ with mock.patch.object(self.test, 'set_robotframework_vars',
return_value=True), \
- mock.patch.object(self.test, 'set_robotframework_vars',
- return_value=True), \
self.assertRaises(RobotError):
self._test_main(TestCasesBase.TestCasesBase.EX_RUN_ERROR, *args)
@mock.patch('robot.run')
@mock.patch('os.makedirs')
def test_main_parse_results_failed(self, *args):
- with mock.patch.object(self.test, 'copy_opnf_testcases',
+ with mock.patch.object(self.test, 'set_robotframework_vars',
return_value=True), \
- mock.patch.object(self.test, 'set_robotframework_vars',
- return_value=True), \
mock.patch.object(self.test, 'parse_results',
side_effect=RobotError):
self._test_main(TestCasesBase.TestCasesBase.EX_RUN_ERROR, *args)
@@ -218,10 +189,8 @@ class ODLTestCasesTesting(unittest.TestCase):
@mock.patch('robot.run')
@mock.patch('os.makedirs')
def test_main_remove_exception(self, *args):
- with mock.patch.object(self.test, 'copy_opnf_testcases',
+ with mock.patch.object(self.test, 'set_robotframework_vars',
return_value=True), \
- mock.patch.object(self.test, 'set_robotframework_vars',
- return_value=True), \
mock.patch.object(self.test, 'parse_results'), \
self.assertRaises(Exception):
self._test_main(TestCasesBase.TestCasesBase.EX_OK, *args)
@@ -230,10 +199,8 @@ class ODLTestCasesTesting(unittest.TestCase):
@mock.patch('robot.run')
@mock.patch('os.makedirs')
def test_main(self, *args):
- with mock.patch.object(self.test, 'copy_opnf_testcases',
+ with mock.patch.object(self.test, 'set_robotframework_vars',
return_value=True), \
- mock.patch.object(self.test, 'set_robotframework_vars',
- return_value=True), \
mock.patch.object(self.test, 'parse_results'):
self._test_main(TestCasesBase.TestCasesBase.EX_OK, *args)
@@ -241,10 +208,8 @@ class ODLTestCasesTesting(unittest.TestCase):
@mock.patch('robot.run')
@mock.patch('os.makedirs', side_effect=OSError(errno.EEXIST, ''))
def test_main_makedirs_oserror17(self, *args):
- with mock.patch.object(self.test, 'copy_opnf_testcases',
+ with mock.patch.object(self.test, 'set_robotframework_vars',
return_value=True), \
- mock.patch.object(self.test, 'set_robotframework_vars',
- return_value=True), \
mock.patch.object(self.test, 'parse_results'):
self._test_main(TestCasesBase.TestCasesBase.EX_OK, *args)
@@ -252,10 +217,8 @@ class ODLTestCasesTesting(unittest.TestCase):
@mock.patch('robot.run', return_value=1)
@mock.patch('os.makedirs')
def test_main_testcases_in_failure(self, *args):
- with mock.patch.object(self.test, 'copy_opnf_testcases',
+ with mock.patch.object(self.test, 'set_robotframework_vars',
return_value=True), \
- mock.patch.object(self.test, 'set_robotframework_vars',
- return_value=True), \
mock.patch.object(self.test, 'parse_results'):
self._test_main(TestCasesBase.TestCasesBase.EX_OK, *args)
@@ -263,10 +226,8 @@ class ODLTestCasesTesting(unittest.TestCase):
@mock.patch('robot.run')
@mock.patch('os.makedirs')
def test_main_remove_oserror(self, *args):
- with mock.patch.object(self.test, 'copy_opnf_testcases',
+ with mock.patch.object(self.test, 'set_robotframework_vars',
return_value=True), \
- mock.patch.object(self.test, 'set_robotframework_vars',
- return_value=True), \
mock.patch.object(self.test, 'parse_results'):
self._test_main(TestCasesBase.TestCasesBase.EX_OK, *args)
diff --git a/functest/tests/unit/utils/__init__.py b/functest/tests/unit/utils/__init__.py
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/functest/tests/unit/utils/__init__.py
diff --git a/functest/tests/unit/utils/test_utils.py b/functest/tests/unit/utils/test_utils.py
new file mode 100644
index 000000000..36313d25d
--- /dev/null
+++ b/functest/tests/unit/utils/test_utils.py
@@ -0,0 +1,29 @@
+#!/usr/bin/env python
+
+# Copyright (c) 2016 Orange and others.
+#
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Apache License, Version 2.0
+# which accompanies this distribution, and is available at
+# http://www.apache.org/licenses/LICENSE-2.0
+
+import logging
+import unittest
+
+from functest.utils import functest_utils
+
+
+class FunctestUtilsTesting(unittest.TestCase):
+
+ logging.disable(logging.CRITICAL)
+
+ def setUp(self):
+ self.test = functest_utils
+
+ def test_check_internet_connectivity(self):
+ self.assertTrue(self.test.check_internet_connectivity())
+# TODO
+# ...
+
+if __name__ == "__main__":
+ unittest.main(verbosity=2)
diff --git a/functest/utils/__init__.py b/functest/utils/__init__.py
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/functest/utils/__init__.py
diff --git a/utils/functest_logger.py b/functest/utils/functest_logger.py
index b154f563d..b154f563d 100644
--- a/utils/functest_logger.py
+++ b/functest/utils/functest_logger.py
diff --git a/utils/functest_utils.py b/functest/utils/functest_utils.py
index 41b6485d9..2d4a652d8 100644
--- a/utils/functest_utils.py
+++ b/functest/utils/functest_utils.py
@@ -439,7 +439,7 @@ def check_test_result(test_name, ret, start_time, stop_time):
def get_testcases_file():
- return FUNCTEST_REPO + "/ci/testcases.yaml"
+ return FUNCTEST_REPO + "/functest/ci/testcases.yaml"
def get_functest_yaml():
diff --git a/utils/functest_vacation.py b/functest/utils/functest_vacation.py
index 0ba094477..0ba094477 100644
--- a/utils/functest_vacation.py
+++ b/functest/utils/functest_vacation.py
diff --git a/utils/openstack_clean.py b/functest/utils/openstack_clean.py
index bf582dea2..bf582dea2 100755
--- a/utils/openstack_clean.py
+++ b/functest/utils/openstack_clean.py
diff --git a/utils/openstack_snapshot.py b/functest/utils/openstack_snapshot.py
index 560cadbdb..560cadbdb 100755
--- a/utils/openstack_snapshot.py
+++ b/functest/utils/openstack_snapshot.py
diff --git a/utils/openstack_tacker.py b/functest/utils/openstack_tacker.py
index 3e0c9cf45..3e0c9cf45 100644
--- a/utils/openstack_tacker.py
+++ b/functest/utils/openstack_tacker.py
diff --git a/utils/openstack_utils.py b/functest/utils/openstack_utils.py
index df6fb5d1a..df6fb5d1a 100755
--- a/utils/openstack_utils.py
+++ b/functest/utils/openstack_utils.py
diff --git a/run_unit_tests.sh b/run_unit_tests.sh
index 80767d4d3..e050418c5 100755
--- a/run_unit_tests.sh
+++ b/run_unit_tests.sh
@@ -2,25 +2,74 @@
set -o errexit
set -o pipefail
+# ******************************
+# prepare the env for the tests
+# ******************************
+# clean useless results dir
+# should be done at the end
+# but in case of crash during unit test
+# clean it anyway
+if [ -d "/home/opnfv/functest/results" ]
+then
+ sudo rm -rf /home/opnfv/functest
+fi
+
+# TODO clean that...
+# Create log dir if needed
+# log shall be disabled during unit tests
+# fix to be done in Logger
+echo "Create dummy log file...."
+sudo mkdir -p /home/opnfv/functest/results/odl
+sudo touch /home/opnfv/functest/results/functest.log
+sudo touch /home/opnfv/functest/results/odl/stdout.txt
+sudo chmod -Rf a+rw /home/opnfv
+
+# Either Workspace is set (CI)
+if [ -z $WORKSPACE ]
+then
+ WORKSPACE="."
+fi
+
+
+# ***************
+# Run unit tests
+# ***************
echo "Running unit tests..."
-cd .
# start vitual env
-virtualenv ./functest_venv
-source ./functest_venv/bin/activate
+virtualenv $WORKSPACE/functest_venv
+source $WORKSPACE/functest_venv/bin/activate
# install python packages
easy_install -U setuptools
easy_install -U pip
-pip install -r docker/requirements.pip
-pip install -e .
+pip install -r $WORKSPACE/docker/requirements.pip
+pip install -e $WORKSPACE
+
+python $WORKSPACE/setup.py develop
# unit tests
+# TODO: remove cover-erase
+# To be deleted when all functest packages will be listed
nosetests --with-xunit \
--with-coverage \
+ --cover-erase \
--cover-package=functest.core.TestCasesBase \
--cover-package=functest.testcases.Controllers.ODL.OpenDaylightTesting \
--cover-xml \
- unit_tests
+ --cover-html \
+ functest/tests/unit
+rc=$?
deactivate
+
+# *******
+# clean
+# *******
+# Clean useless logs
+if [ -d "/home/opnfv/functest/results" ]
+then
+ sudo rm -rf /home/opnfv/functest/results
+fi
+
+exit $rc
diff --git a/setup.py b/setup.py
index 58740f4aa..c192bd93b 100644
--- a/setup.py
+++ b/setup.py
@@ -19,6 +19,4 @@ setup(
install_requires=["coverage==4.1",
"mock==1.3.0",
"nose==1.3.7"],
- entry_points={
- }
)
diff --git a/testcases/Controllers/ODL/custom_tests/neutron/001__reachability.robot b/testcases/Controllers/ODL/custom_tests/neutron/001__reachability.robot
deleted file mode 100644
index c2714c691..000000000
--- a/testcases/Controllers/ODL/custom_tests/neutron/001__reachability.robot
+++ /dev/null
@@ -1,30 +0,0 @@
-*** Variables ***
-${NeutronNorthbound} /controller/nb/v2/neutron
-${NetworkNorthbound} ${NeutronNorthbound}/networks
-${SubnetNorthbound} ${NeutronNorthbound}/subnets
-${PortNorthbound} ${NeutronNorthbound}/ports
-
-*** Settings ***
-Suite Setup Create Session ODL http://${ODL_SYSTEM_IP}:${PORT} headers=${HEADERS} auth=${AUTH}
-Suite Teardown Delete All Sessions
-Library RequestsLibrary
-Variables ../../../variables/Variables.py
-
-*** Test Cases ***
-Get the complete list of networks
- [Documentation] Get the complete list of networks
- [Tags] reachability
- ${resp} get request ODL ${NetworkNorthbound}
- Should be Equal As Strings ${resp.status_code} 200
-
-Get the complete list of subnets
- [Documentation] Get the complete list of subnets
- [Tags] reachability
- ${resp} get request ODL ${SubnetNorthbound}
- Should be Equal As Strings ${resp.status_code} 200
-
-Get the complete list of ports
- [Documentation] Get the complete list of ports
- [Tags] reachability
- ${resp} get request ODL ${PortNorthbound}
- Should be Equal As Strings ${resp.status_code} 200
diff --git a/testcases/features/sfc/sfc.py b/testcases/features/sfc/sfc.py
deleted file mode 100755
index 96ea3ab39..000000000
--- a/testcases/features/sfc/sfc.py
+++ /dev/null
@@ -1,552 +0,0 @@
-import os
-import subprocess
-import sys
-import time
-import argparse
-import paramiko
-
-import functest.utils.functest_logger as ft_logger
-import functest.utils.functest_utils as ft_utils
-import functest.utils.openstack_utils as os_utils
-import SSHUtils as ssh_utils
-import ovs_utils
-
-parser = argparse.ArgumentParser()
-
-parser.add_argument("-r", "--report",
- help="Create json result file",
- action="store_true")
-
-args = parser.parse_args()
-
-""" logging configuration """
-logger = ft_logger.Logger("ODL_SFC").getLogger()
-
-FUNCTEST_RESULTS_DIR = '/home/opnfv/functest/results/odl-sfc'
-FUNCTEST_REPO = ft_utils.FUNCTEST_REPO
-
-HOME = os.environ['HOME'] + "/"
-
-VM_BOOT_TIMEOUT = 180
-INSTANCE_NAME = "client"
-FLAVOR = "custom"
-IMAGE_NAME = "sf_nsh_colorado"
-IMAGE_FILENAME = "sf_nsh_colorado.qcow2"
-IMAGE_FORMAT = "qcow2"
-IMAGE_PATH = "/home/opnfv/functest/data" + "/" + IMAGE_FILENAME
-
-# NEUTRON Private Network parameters
-
-NET_NAME = "example-net"
-SUBNET_NAME = "example-subnet"
-SUBNET_CIDR = "11.0.0.0/24"
-ROUTER_NAME = "example-router"
-
-SECGROUP_NAME = "example-sg"
-SECGROUP_DESCR = "Example Security group"
-
-INSTANCE_NAME_2 = "server"
-
-# TEST_DB = ft_utils.get_parameter_from_yaml("results.test_db_url")
-
-PRE_SETUP_SCRIPT = 'sfc_pre_setup.bash'
-TACKER_SCRIPT = 'sfc_tacker.bash'
-TEARDOWN_SCRIPT = "sfc_teardown.bash"
-TACKER_CHANGECLASSI = "sfc_change_classi.bash"
-
-ssh_options = '-o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no'
-
-PROXY = {
- 'ip': '10.20.0.2',
- 'username': 'root',
- 'password': 'r00tme'
-}
-
-
-def check_ssh(ip):
- cmd = "sshpass -p opnfv ssh " + ssh_options + " -q " + ip + " exit"
- success = subprocess.call(cmd, shell=True) == 0
- if not success:
- logger.debug("Wating for SSH connectivity in SF with IP: %s" % ip)
- return success
-
-
-def main():
-
- # Allow any port so that tacker commands reaches the server.
- # This will be deleted when tacker is included in OPNFV installation
-
- status = "PASS"
- failures = 0
- start_time = time.time()
- json_results = {}
-
- contr_cmd = ("sshpass -p r00tme ssh " + ssh_options + " root@10.20.0.2"
- " 'fuel node'|grep controller|awk '{print $10}'")
- logger.info("Executing script to get ip_server: '%s'" % contr_cmd)
- process = subprocess.Popen(contr_cmd,
- shell=True,
- stdout=subprocess.PIPE,
- stderr=subprocess.PIPE)
- ip_server = process.stdout.readline().rstrip()
-
- comp_cmd = ("sshpass -p r00tme ssh " + ssh_options + " root@10.20.0.2"
- " 'fuel node'|grep compute|awk '{print $10}'")
- logger.info("Executing script to get compute IPs: '%s'" % comp_cmd)
- process = subprocess.Popen(comp_cmd,
- shell=True,
- stdout=subprocess.PIPE,
- stderr=subprocess.PIPE)
- ip_computes = [ip.strip() for ip in process.stdout.readlines()]
-
- iptable_cmd1 = ("sshpass -p r00tme ssh " + ssh_options + " root@10.20.0.2"
- " ssh " + ip_server + " iptables -P INPUT ACCEPT ")
- iptable_cmd2 = ("sshpass -p r00tme ssh " + ssh_options + " root@10.20.0.2"
- " ssh " + ip_server + " iptables -t nat -P INPUT ACCEPT ")
- iptable_cmd3 = ("sshpass -p r00tme ssh " + ssh_options + " root@10.20.0.2"
- " ssh " + ssh_options + " " + ip_server +
- " iptables -A INPUT -m state"
- " --state NEW,ESTABLISHED,RELATED -j ACCEPT")
-
- logger.info("Changing firewall policy in controller: '%s'" % iptable_cmd1)
- subprocess.call(iptable_cmd1, shell=True, stderr=subprocess.PIPE)
-
- logger.info("Changing firewall policy in controller: '%s'" % iptable_cmd2)
- subprocess.call(iptable_cmd2, shell=True, stderr=subprocess.PIPE)
-
- logger.info("Changing firewall policy in controller: '%s'" % iptable_cmd3)
- subprocess.call(iptable_cmd3, shell=True, stderr=subprocess.PIPE)
-
-# Getting the different clients
-
- nova_client = os_utils.get_nova_client()
- neutron_client = os_utils.get_neutron_client()
- glance_client = os_utils.get_glance_client()
-
- ovs_logger = ovs_utils.OVSLogger(
- os.path.join(os.getcwd(), 'ovs-logs'),
- FUNCTEST_RESULTS_DIR)
-
- controller_clients = [ssh_utils.get_ssh_client(ip_server,
- 'root',
- proxy=PROXY)]
- compute_clients = []
- for c_ip in ip_computes:
- c_client = ssh_utils.get_ssh_client(c_ip,
- 'root',
- proxy=PROXY)
- compute_clients.append(c_client)
-
-# Download the image
-
- if not os.path.isfile(IMAGE_PATH):
- logger.info("Downloading image")
- ft_utils.download_url(
- "http://artifacts.opnfv.org/sfc/demo/sf_nsh_colorado.qcow2",
- "/home/opnfv/functest/data/")
- else:
- logger.info("Using old image")
-
-# Create glance image and the neutron network
-
- image_id = os_utils.create_glance_image(glance_client,
- IMAGE_NAME,
- IMAGE_PATH,
- disk=IMAGE_FORMAT,
- container="bare",
- public=True)
-
- network_dic = os_utils.create_network_full(neutron_client,
- NET_NAME,
- SUBNET_NAME,
- ROUTER_NAME,
- SUBNET_CIDR)
- if not network_dic:
- logger.error(
- "There has been a problem when creating the neutron network")
- sys.exit(-1)
-
- network_id = network_dic["net_id"]
-
- sg_id = os_utils.create_security_group_full(neutron_client,
- SECGROUP_NAME, SECGROUP_DESCR)
-
- secgroups = os_utils.get_security_groups(neutron_client)
-
- for sg in secgroups:
- os_utils.create_secgroup_rule(neutron_client, sg['id'],
- 'ingress', 'tcp',
- port_range_min=22,
- port_range_max=22)
- os_utils.create_secgroup_rule(neutron_client, sg['id'],
- 'egress', 'tcp',
- port_range_min=22,
- port_range_max=22)
- os_utils.create_secgroup_rule(neutron_client, sg['id'],
- 'ingress', 'tcp',
- port_range_min=80,
- port_range_max=80)
- os_utils.create_secgroup_rule(neutron_client, sg['id'],
- 'egress', 'tcp',
- port_range_min=80,
- port_range_max=80)
-
- _, custom_flv_id = os_utils.get_or_create_flavor(
- 'custom', 1500, 10, 1, public=True)
- if not custom_flv_id:
- logger.error("Failed to create custom flavor")
- sys.exit(1)
-
- # boot INSTANCE
- logger.info("Creating instance '%s'..." % INSTANCE_NAME)
- logger.debug(
- "Configuration:\n name=%s \n flavor=%s \n image=%s \n "
- "network=%s \n" % (INSTANCE_NAME, FLAVOR, image_id, network_id))
- instance = os_utils.create_instance_and_wait_for_active(FLAVOR,
- image_id,
- network_id,
- INSTANCE_NAME,
- av_zone='nova')
-
- if instance is None:
- logger.error("Error while booting instance.")
- sys.exit(-1)
- # Retrieve IP of INSTANCE
- instance_ip = instance.networks.get(NET_NAME)[0]
- logger.debug("Instance '%s' got private ip '%s'." %
- (INSTANCE_NAME, instance_ip))
-
- logger.info("Adding '%s' to security group '%s'..."
- % (INSTANCE_NAME, SECGROUP_NAME))
- os_utils.add_secgroup_to_instance(nova_client, instance.id, sg_id)
-
- logger.info("Creating floating IP for VM '%s'..." % INSTANCE_NAME)
- floatip_dic = os_utils.create_floating_ip(neutron_client)
- floatip_client = floatip_dic['fip_addr']
- # floatip_id = floatip_dic['fip_id']
-
- if floatip_client is None:
- logger.error("Cannot create floating IP.")
- sys.exit(-1)
- logger.info("Floating IP created: '%s'" % floatip_client)
-
- logger.info("Associating floating ip: '%s' to VM '%s' "
- % (floatip_client, INSTANCE_NAME))
- if not os_utils.add_floating_ip(nova_client, instance.id, floatip_client):
- logger.error("Cannot associate floating IP to VM.")
- sys.exit(-1)
-
-# STARTING SECOND VM (server) ###
-
- # boot INTANCE
- logger.info("Creating instance '%s'..." % INSTANCE_NAME_2)
- logger.debug(
- "Configuration:\n name=%s \n flavor=%s \n image=%s \n "
- "network=%s \n" % (INSTANCE_NAME_2, FLAVOR, image_id, network_id))
- instance_2 = os_utils.create_instance_and_wait_for_active(FLAVOR,
- image_id,
- network_id,
- INSTANCE_NAME_2,
- av_zone='nova')
-
- if instance_2 is None:
- logger.error("Error while booting instance.")
- sys.exit(-1)
- # Retrieve IP of INSTANCE
- instance_ip_2 = instance_2.networks.get(NET_NAME)[0]
- logger.debug("Instance '%s' got private ip '%s'." %
- (INSTANCE_NAME_2, instance_ip_2))
-
- logger.info("Adding '%s' to security group '%s'..."
- % (INSTANCE_NAME_2, SECGROUP_NAME))
- os_utils.add_secgroup_to_instance(nova_client, instance_2.id, sg_id)
-
- logger.info("Creating floating IP for VM '%s'..." % INSTANCE_NAME_2)
- floatip_dic = os_utils.create_floating_ip(neutron_client)
- floatip_server = floatip_dic['fip_addr']
- # floatip_id = floatip_dic['fip_id']
-
- if floatip_server is None:
- logger.error("Cannot create floating IP.")
- sys.exit(-1)
- logger.info("Floating IP created: '%s'" % floatip_server)
-
- logger.info("Associating floating ip: '%s' to VM '%s' "
- % (floatip_server, INSTANCE_NAME_2))
-
- if not os_utils.add_floating_ip(nova_client,
- instance_2.id,
- floatip_server):
- logger.error("Cannot associate floating IP to VM.")
- sys.exit(-1)
-
- # CREATION OF THE 2 SF ####
-
- tacker_script = "%s/testcases/features/sfc/%s" % \
- (FUNCTEST_REPO, TACKER_SCRIPT)
- logger.info("Executing tacker script: '%s'" % tacker_script)
- subprocess.call(tacker_script, shell=True)
-
- # SSH CALL TO START HTTP SERVER
- ssh = paramiko.SSHClient()
- ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
-
- try:
- ssh.connect(floatip_server, username="root",
- password="opnfv", timeout=2)
- command = "python -m SimpleHTTPServer 80 > /dev/null 2>&1 &"
- logger.info("Starting HTTP server")
- (stdin, stdout, stderr) = ssh.exec_command(command)
- except:
- logger.debug("Waiting for %s..." % floatip_server)
- time.sleep(6)
- # timeout -= 1
-
- instances = nova_client.servers.list(search_opts={'all_tenants': 1})
- ips = []
- try:
- for instance in instances:
- if "server" not in instance.name:
- if "client" not in instance.name:
- logger.debug(
- "This is the instance name: %s " % instance.name)
- floatip_dic = os_utils.create_floating_ip(neutron_client)
- floatip = floatip_dic['fip_addr']
- ips.append(floatip)
- instance.add_floating_ip(floatip)
- except:
- logger.debug("Problems assigning floating IP to SFs")
-
- # If no IPs were obtained, then we cant continue
- if not ips:
- logger.error('Failed to obtain IPs, cant continue, exiting')
- return
-
- logger.debug("Floating IPs for SFs: %s..." % ips)
-
- # Check SSH connectivity to VNFs
- r = 0
- retries = 100
- check = [False, False]
-
- logger.info("Checking SSH connectivity to the SFs with ips %s" % str(ips))
- while r < retries and not all(check):
- try:
- check = [check_ssh(ips[0]), check_ssh(ips[1])]
- except Exception:
- logger.exception("SSH check failed")
- check = [False, False]
- time.sleep(3)
- r += 1
-
- if not all(check):
- logger.error("Cannot establish SSH connection to the SFs")
- sys.exit(1)
-
- logger.info("SSH connectivity to the SFs established")
-
- # SSH TO START THE VXLAN_TOOL ON SF1
- logger.info("Configuring the SFs")
- try:
- ssh.connect(ips[0], username="root",
- password="opnfv", timeout=2)
- command = ("nohup python vxlan_tool.py -i eth0 "
- "-d forward -v off -b 80 > /dev/null 2>&1 &")
- (stdin, stdout, stderr) = ssh.exec_command(command)
- except:
- logger.debug("Waiting for %s..." % ips[0])
- time.sleep(6)
- # timeout -= 1
-
- try:
- while 1:
- (stdin, stdout, stderr) = ssh.exec_command(
- "ps aux | grep \"vxlan_tool.py\" | grep -v grep")
- if len(stdout.readlines()) > 0:
- logger.debug("HTTP firewall started")
- break
- else:
- logger.debug("HTTP firewall not started")
- time.sleep(3)
- except Exception:
- logger.exception("vxlan_tool not started in SF1")
-
- # SSH TO START THE VXLAN_TOOL ON SF2
- try:
- ssh.connect(ips[1], username="root",
- password="opnfv", timeout=2)
- command = ("nohup python vxlan_tool.py -i eth0 "
- "-d forward -v off -b 22 > /dev/null 2>&1 &")
- (stdin, stdout, stderr) = ssh.exec_command(command)
- except:
- logger.debug("Waiting for %s..." % ips[1])
- time.sleep(6)
- # timeout -= 1
-
- try:
- while 1:
- (stdin, stdout, stderr) = ssh.exec_command(
- "ps aux | grep \"vxlan_tool.py\" | grep -v grep")
- if len(stdout.readlines()) > 0:
- logger.debug("SSH firewall started")
- break
- else:
- logger.debug("SSH firewall not started")
- time.sleep(3)
- except Exception:
- logger.exception("vxlan_tool not started in SF2")
-
- i = 0
-
- # SSH TO EXECUTE cmd_client
- logger.info("TEST STARTED")
- try:
- ssh.connect(floatip_client, username="root",
- password="opnfv", timeout=2)
- command = "nc -w 5 -zv " + instance_ip_2 + " 22 2>&1"
- (stdin, stdout, stderr) = ssh.exec_command(command)
-
- # WRITE THE CORRECT WAY TO DO LOGGING
- if "timed out" in stdout.readlines()[0]:
- logger.info('\033[92m' + "TEST 1 [PASSED] "
- "==> SSH BLOCKED" + '\033[0m')
- i = i + 1
- json_results.update({"Test 1: SSH Blocked": "Passed"})
- else:
- timestamp = time.strftime("%Y%m%d-%H%M%S")
- error = ('\033[91m' + "TEST 1 [FAILED] "
- "==> SSH NOT BLOCKED" + '\033[0m')
- logger.error(error)
- ovs_logger.dump_ovs_logs(controller_clients,
- compute_clients,
- related_error=error,
- timestamp=timestamp)
- status = "FAIL"
- json_results.update({"Test 1: SSH Blocked": "Failed"})
- failures += 1
- except:
- logger.debug("Waiting for %s..." % floatip_client)
- time.sleep(6)
- # timeout -= 1
-
- # SSH TO EXECUTE cmd_client
- try:
- ssh.connect(floatip_client, username="root",
- password="opnfv", timeout=2)
- command = "nc -w 5 -zv " + instance_ip_2 + " 80 2>&1"
- (stdin, stdout, stderr) = ssh.exec_command(command)
-
- if "succeeded" in stdout.readlines()[0]:
- logger.info('\033[92m' + "TEST 2 [PASSED] "
- "==> HTTP WORKS" + '\033[0m')
- i = i + 1
- json_results.update({"Test 2: HTTP works": "Passed"})
- else:
- timestamp = time.strftime("%Y%m%d-%H%M%S")
- error = ('\033[91m' + "TEST 2 [FAILED] "
- "==> HTTP BLOCKED" + '\033[0m')
- logger.error(error)
- ovs_logger.dump_ovs_logs(controller_clients,
- compute_clients,
- related_error=error,
- timestamp=timestamp)
- status = "FAIL"
- json_results.update({"Test 2: HTTP works": "Failed"})
- failures += 1
- except:
- logger.debug("Waiting for %s..." % floatip_client)
- time.sleep(6)
- # timeout -= 1
-
- # CHANGE OF CLASSIFICATION #
- logger.info("Changing the classification")
- tacker_classi = "%s/testcases/features/sfc/%s" % \
- (FUNCTEST_REPO, TACKER_CHANGECLASSI)
- subprocess.call(tacker_classi, shell=True)
-
- logger.info("Wait for ODL to update the classification rules in OVS")
- time.sleep(100)
-
- # SSH TO EXECUTE cmd_client
-
- try:
- ssh.connect(floatip_client, username="root",
- password="opnfv", timeout=2)
- command = "nc -w 5 -zv " + instance_ip_2 + " 80 2>&1"
- (stdin, stdout, stderr) = ssh.exec_command(command)
-
- if "timed out" in stdout.readlines()[0]:
- logger.info('\033[92m' + "TEST 3 [PASSED] "
- "==> HTTP BLOCKED" + '\033[0m')
- i = i + 1
- json_results.update({"Test 3: HTTP Blocked": "Passed"})
- else:
- timestamp = time.strftime("%Y%m%d-%H%M%S")
- error = ('\033[91m' + "TEST 3 [FAILED] "
- "==> HTTP NOT BLOCKED" + '\033[0m')
- logger.error(error)
- ovs_logger.dump_ovs_logs(controller_clients,
- compute_clients,
- related_error=error,
- timestamp=timestamp)
- status = "FAIL"
- json_results.update({"Test 3: HTTP Blocked": "Failed"})
- failures += 1
- except:
- logger.debug("Waiting for %s..." % floatip_client)
- time.sleep(6)
- # timeout -= 1
-
- # SSH TO EXECUTE cmd_client
- try:
- ssh.connect(floatip_client, username="root",
- password="opnfv", timeout=2)
- command = "nc -w 5 -zv " + instance_ip_2 + " 22 2>&1"
- (stdin, stdout, stderr) = ssh.exec_command(command)
-
- if "succeeded" in stdout.readlines()[0]:
- logger.info('\033[92m' + "TEST 4 [PASSED] "
- "==> SSH WORKS" + '\033[0m')
- i = i + 1
- json_results.update({"Test 4: SSH works": "Passed"})
- else:
- timestamp = time.strftime("%Y%m%d-%H%M%S")
- error = ('\033[91m' + "TEST 4 [FAILED] "
- "==> SSH BLOCKED" + '\033[0m')
- logger.error(error)
- ovs_logger.dump_ovs_logs(controller_clients,
- compute_clients,
- related_error=error,
- timestamp=timestamp)
- status = "FAIL"
- json_results.update({"Test 4: SSH works": "Failed"})
- failures += 1
- except:
- logger.debug("Waiting for %s..." % floatip_client)
- time.sleep(6)
- # timeout -= 1
-
- ovs_logger.create_artifact_archive()
-
- if i == 4:
- for x in range(0, 5):
- logger.info('\033[92m' + "SFC TEST WORKED"
- " :) \n" + '\033[0m')
-
- if args.report:
- stop_time = time.time()
- json_results.update({"tests": "4", "failures": int(failures)})
- logger.debug("Promise Results json: " + str(json_results))
- ft_utils.push_results_to_db("sfc",
- "functest-odl-sfc",
- start_time,
- stop_time,
- status,
- json_results)
- if status == "PASS":
- sys.exit(0)
- else:
- sys.exit(1)
-
-if __name__ == '__main__':
- main()