From: Yu Yang (Gabriel) Date: Mon, 17 Jul 2017 03:48:30 +0000 (+0000) Subject: Merge "Add test monitoring module" X-Git-Tag: opnfv-5.0.0~27 X-Git-Url: https://gerrit.opnfv.org/gerrit/gitweb?a=commitdiff_plain;h=b26f701ab2327497b0e44f548ea18e24b1e6b0d9;hp=e7c3c796b1d620f3e26c64733235f45aef2cae5c;p=bottlenecks.git Merge "Add test monitoring module" --- diff --git a/config/config.yaml b/config/config.yaml index 19ffa4ce..14a44be7 100644 --- a/config/config.yaml +++ b/config/config.yaml @@ -10,5 +10,6 @@ common_config: log_dir: '/tmp/' rc_dir: '/tmp/admin_rc.sh' + yardstick_rc_dir: '/etc/yardstick/openstack.creds' releng_dir: '/home/opnfv/releng' fetch_os_file: 'utils/fetch_os_creds.sh' \ No newline at end of file diff --git a/docs/release/release-notes/release_notes.rst b/docs/release/release-notes/release_notes.rst index d529bf7d..fae8760a 100644 --- a/docs/release/release-notes/release_notes.rst +++ b/docs/release/release-notes/release_notes.rst @@ -194,8 +194,7 @@ Documentatiion Deliverables Reason for Version ================== -* In Danube, POSCA testsuite is introduced and two stress tests are implemented. Rubbos and vstf are -not supported in this release. Their documentations for former releases will only be kept this release. +* In Danube, POSCA testsuite is introduced and two stress tests are implemented. Rubbos and vstf are not supported in this release. Their documentations for former releases will only be kept this release. * In Colorado, rubbos is refactored by using puppet, which makes it quite flexible to configure with different number of load generator(Client), worker(tomcat). * In Colorado, vstf is refactored by extracting the test case's configuration information. diff --git a/docs/testing/developer/devguide/framework_guide.rst b/docs/testing/developer/devguide/framework_guide.rst new file mode 100644 index 00000000..79bd1f97 --- /dev/null +++ b/docs/testing/developer/devguide/framework_guide.rst @@ -0,0 +1,14 @@ +.. This work is licensed under a Creative Commons Attribution 4.0 International License. +.. http://creativecommons.org/licenses/by/4.0 +.. (c) Huawei Technologies Co.,Ltd and others. + +***************************** +Bottlenecks - Framework Guide +***************************** + + +Introduction +============ + +This document will provide a comprehensive guilde on Bottlenecks testing +framework development. diff --git a/docs/testing/developer/devguide/index.rst b/docs/testing/developer/devguide/index.rst index 8d57ead0..19f12ca3 100644 --- a/docs/testing/developer/devguide/index.rst +++ b/docs/testing/developer/devguide/index.rst @@ -2,15 +2,13 @@ .. http://creativecommons.org/licenses/by/4.0 .. (c) Huawei Technologies Co.,Ltd and others. -*************************** -Bottlenecks - Testing Guide -*************************** +***************************** +Bottlenecks - Developer Guide +***************************** .. toctree:: :maxdepth: 1 - ./overview.rst - ./posca_guide.rst - ./dashboard_guide.rst - ./deprecated.rst - + ./quick_start.rst + ./framework_guide.rst + ./package_guide.rst diff --git a/docs/testing/developer/devguide/package_guide.rst b/docs/testing/developer/devguide/package_guide.rst new file mode 100644 index 00000000..19bc6ed3 --- /dev/null +++ b/docs/testing/developer/devguide/package_guide.rst @@ -0,0 +1,14 @@ +.. This work is licensed under a Creative Commons Attribution 4.0 International License. +.. http://creativecommons.org/licenses/by/4.0 +.. (c) Huawei Technologies Co.,Ltd and others. + +**************************** +Bottlenecks - Package Guilde +**************************** + + +Introduction +============ + +This document will provide a comprehensive guilde on packages library for +developers. diff --git a/docs/testing/developer/devguide/quick_start.rst b/docs/testing/developer/devguide/quick_start.rst new file mode 100644 index 00000000..337c1ef2 --- /dev/null +++ b/docs/testing/developer/devguide/quick_start.rst @@ -0,0 +1,14 @@ +.. This work is licensed under a Creative Commons Attribution 4.0 International License. +.. http://creativecommons.org/licenses/by/4.0 +.. (c) Huawei Technologies Co.,Ltd and others. + +************************************* +Bottlenecks - A Developer Quick Start +************************************* + + +Introduction +============ + +This document will provide general view of the project for developers as a +quick guide. diff --git a/docs/testing/developer/devguide/rubbos_guide.rst b/docs/testing/developer/devguide/rubbos_guide.rst deleted file mode 100644 index 4d92d2e2..00000000 --- a/docs/testing/developer/devguide/rubbos_guide.rst +++ /dev/null @@ -1,128 +0,0 @@ -.. This work is licensed under a Creative Commons Attribution 4.0 International License. -.. http://creativecommons.org/licenses/by/4.0 -.. (c) Huawei Technologies Co.,Ltd and others. - -********************** -Rubbos Testsuite Guide -********************** - - -Rubbos Introduction -==================== -Rubbos is a bulletin board benchmark modeled after an online news forum like Slashdot. -It is an open source Middleware and an n-tier system model which -is used to be deployed on multiple physical node and -to measure the whole performacne of OPNFV platform. -Rubbos can deploy the Apache, tomcat, and DB. -Based on the deployment, rubbos gives the pressure to the whole system. -When the system reaches to the peak, the throughput will not grow more. -This testcase can help to understand the bottlenecks of OPNFV plantform -and improve the performance of OPNFV platform. - -Detailed workflow is illutrated below. - -.. image:: ../images/Framework_Setup.png - :width: 770px - :alt: Bottlenecks Framework Setup - -Preinstall Packages -==================== -There is a need to install some packages before running the rubbos, -gcc, gettext, g++, libaio1, libaio-dev, make and git are necessary. -When the rubbos runs on the OPNFV community continuous integration(CI) -system, the required packages are installed automately as shown in the -code repository, which is /utils/infra_setup/vm_dev_setup/packages.conf, -besides, the packages can be encapsulated in the images initially. -If someone wants to use rubbos locally, he/she has to install them by -hand, such as in ubuntu 14.04, - -.. code-block:: bash - - apt-get update - apt-get install gettext - -How does Rubbos Integrate into Installers -========================================= -1.Community CI System - -Rubbos has been successfully integrated into fuel and compass with NOSDN scenario -in OPNFV community CI system. - -Heat is used to create 9 instances, which is shown in -/utils/infra_setup/heat_template/HOT_create_instance.sh, the 9 instances are used -for installing Apache, Tomcat, Mysql, Control, Benchmark and 4 Clients. The tools, -such as rubbos, sysstat, oprofile, etc, are installed in these instances to perform -the test, the test results are stored in the Benchmark instance initially, then they -are copied to the Rubbos_result instance, finally, the test results are transferred to -the community dashboard. - -There's a need to store our pakages as large as M bytes or G bytes size, such as -the images, jdk, apache-ant, apache-tomcat, etc, the OPNFV community storage system, -Google Cloud Storage, is used, the pakages can be downloaded from -https://artifacts.opnfv.org/bottlenecks/rubbos. - -2.Local Deployment - -If someone wants to run the rubbos in his own environment, he/she can keep to the following steps, - -2.1 Start up instances by using heat, nova or libvert. In Openstack Environemnt, -the heat script can refer /utils/infra_setup/heat_template/HOT_create_instance.sh, -if the openstack doesn't support heat module, -the script /utils/infra_setup/create_instance.sh can be used. -Without Openstack, there's a way to set up instances by using libvert, the scripts are shown under -the directory /utils/rubbos_dev_env_setup. - -The image can be downloaded from the community cloud storage - -.. code-block:: bash - - curl --connect-timeout 10 -o bottlenecks-trusty-server.img - http://artifacts.opnfv.org/bottlenecks/rubbos/bottlenecks-trusty-server.img - -2.2 Ssh into the control node and clone the bottlenecks codes to the root directory. - -.. code-block:: bash - - git clone https://git.opnfv.org/bottlenecks /bottlenecks - -2.3 Download the packages and decompress them into the proper directory. - -.. code-block:: bash - - curl --connect-timeout 10 -o app_tools.tar.gz - http://artifacts.opnfv.org/bottlenecks/rubbos/app_tools.tar.gz - curl --connect-timeout 10 -o rubbosMulini6.tar.gz - http://artifacts.opnfv.org/bottlenecks/rubbos/rubbosMulini6.tar.gz - -.. code-block:: bash - - tar zxf app_tools.tar.gz -C /bottlenecks/rubbos - tar zxf rubbosMulini6.tar.gz -C /bottlenecks/rubbos/rubbos_scripts - -2.4 Ssh into the Control node and run the script - -.. code-block:: bash - - source /bottlenecks/rubbos/rubbos_scripts/1-1-1/scripts/run.sh - -2.5 Check the test results under the directory /bottlenecks/rubbos/rubbos_results in -Control node. The results are stored in the format of xml, -move them to the brower chrome, then you can see the results. - -Test Result Description -======================= -In OPNFV community, the result is shown in the following format - -:: - - [{'client': 200, 'throughput': 27}, - {'client': 700, 'throughput': 102}, - {'client': 1200, 'throughput': 177}, - {'client': 1700, 'throughput': 252}, - {'client': 2200, 'throughput': 323}, - {'client': 2700, 'throughput': 399}, - {'client': 3200, 'throughput': 473}] - -The results are transferred to the community database and a map is drawed on the dashboard. -Along with the growth of the number of the client, the throughput grows at first, then meets -up with a point of inflexion, which is caused by the bottlenecks of the measured system. diff --git a/docs/testing/developer/devguide/vstf_guide.rst b/docs/testing/developer/devguide/vstf_guide.rst deleted file mode 100644 index e1ad5f2b..00000000 --- a/docs/testing/developer/devguide/vstf_guide.rst +++ /dev/null @@ -1,241 +0,0 @@ -.. This work is licensed under a Creative Commons Attribution 4.0 International License. -.. http://creativecommons.org/licenses/by/4.0 -.. (c) Huawei Technologies Co.,Ltd and others. - -******************** -VSTF Testsuite Guide -******************** - -VSTF Introduction -==================== -VSTF(Virtual Switch Test Framework) is a system-level testing framework in the -area of network virtualization, and it could help you estimate the system switch -ability and find out the network bottlenecks by main KPIs(bandwidth, latency, -resource usage and so on), VSTF owns a methodology to define the test scenario and -testcases, Now we could support Tu testcases in the Openstack environment, More -scenarios and cases will be added. - -VSTF TestScenario ------------------ -1. Tu - VM to VM -2. Tn - Physical Nic loopback -3. TnV - VNF loopback -4. Ti - VM to Physical Nic - -Pre-install Packages on the ubuntu 14.04 VM -=========================================== -VSTF VM Preparation Steps -------------------------- -1. Create a ubuntu 14.04 VM -2. Install dependency inside VM -3. Install vstf python package inside VM - -VM preparation --------------- -Install python2.7 version and git - -:: - - sudo apt-get install python2.7 - sudo apt-get install git - -Download Bottlenecks package - -:: - - sudo cd /home/ - sudo git clone https://gerrit.opnfv.org/gerrit/bottlenecks - -Install the dependency - -:: - - sudo apt-get install python-pip - sudo pip install --upgrade pip - sudo dpkg-reconfigure dash - sudo apt-get install libjpeg-dev - sudo apt-get install libpng-dev - sudo apt-get install python-dev - sudo apt-get install python-testrepository - sudo apt-get install git - sudo apt-get install python-pika - sudo apt-get install python-oslo.config - sudo pip install -r /home/bottlenecks/vstf/requirements.txt - -Install vstf package - -:: - - sudo mkdir -p /var/log/vstf/ - sudo cp -r /home/bottlenecks/vstf/etc/vstf/ /etc/ - sudo mkdir -p /opt/vstf/ - sudo cd /home/bottlenecks;sudo rm -rf build/ - sudo python setup.py install - -Image on the Cloud ------------------- -+-----------+-------------------------------------------------------------+ -| Name | vstf-image | -+===========+=============================================================+ -| URL | http://artifacts.opnfv.org/bottlenecks/vstf-manager-new.img | -+-----------+-------------------------------------------------------------+ -| Format | QCOW2 | -+-----------+-------------------------------------------------------------+ -| Size | 5G | -+-----------+-------------------------------------------------------------+ -| User | root | -+-----------+-------------------------------------------------------------+ -| Passwd | root | -+-----------+-------------------------------------------------------------+ -There is a complete vstf image on the cloud ,you could download it and use it to -deploy and run cases ,but do not need VM preparation steps. - - -How is VSTF Integrated into Installers -======================================== -VM requirements ---------------- -+------------------+----------+--------------------+-----------------------------------------------------+ -| Name | FLAVOR | IMAGE_NAME | NETWORK | -+==================+==========+====================+=====================================================+ -| vstf-manager | m1.large | vstf-image | control-plane=XX.XX.XX.XX | -+------------------+----------+--------------------+-----------------------------------------------------+ -| vstf-tester | m1.large | vstf-image | control-plane(eth0)=XX.XX.XX.XX | -| | | | test-plane(eth1)=XX.XX.XX.XX | -+------------------+----------+--------------------+-----------------------------------------------------+ -| vstf-target | m1.large | vstf-image | control-plane(eth0)=XX.XX.XX.XX | -| | | | test-plane(eth1)=XX.XX.XX.XX | -+------------------+----------+--------------------+-----------------------------------------------------+ -m1.large means 4U4G for the target image Size 5GB -For the network used by VMs,network need two plane ,one plane is control plane and the other plane is test plane. - -OPNFV community Usage in the CI system --------------------------------------- -+---------------------------------------+---------------------------------------+ -| Project Name | Project Categoty | -+=======================================+=======================================+ -| bottlenecks-daily-fuel-vstf-lf-master | bottlenecks | -+---------------------------------------+---------------------------------------+ -OPNFV community jenkins Project info - -Main Entrance for the ci test: - -:: - - cd /home/bottlenecks/ci; - bash -x vstf_run.sh - -Test on local(Openstack Environment) ------------------------------------- -download the image file - -:: - - curl --connect-timeout 10 -o /tmp/vstf-manager.img \ - http://artifacts.opnfv.org/bottlenecks/vstf-manager-new.img -v - -create the image file by the glance - -:: - - glance image-create --name $MANAGER_IMAGE_NAME \ - --disk-format qcow2 \ - --container-format bare \ - --file /tmp/vstf-manager.img - -create the keypair for the image(anyone will be ok) - -:: - - cd /home/bottlenecks/utils/infra_setup/bottlenecks_key - nova keypair-add --pub_key $KEY_PATH/bottlenecks_key.pub $KEY_NAME - -create the vstf three VMs in the openstack by heat - -:: - - cd /home/bottlenecks/utils/infra_setup/heat_template/vstf_heat_template - heat stack-create vstf -f bottleneck_vstf.yaml - -launch the vstf process inside the vstf-manager vstf-tester vstf-target VMs - -:: - - cd /home/bottlenecks/utils/infra_setup/heat_template/vstf_heat_template - bash -x launch_vstf.sh - -edit the test scenario and test packet list in the vstf_test.sh, now support the Tu-1/2/3 - -:: - - function fn_testing_scenario(){ - ... - local test_length_list="64 128 256 512 1024" - local test_scenario_list="Tu-1 Tu-3" - ... - } - -launch the vstf script - -:: - - cd /home/bottlenecks/utils/infra_setup/heat_template/vstf_heat_template - bash -x vstf_test.sh - -Test Result Description -======================= -Result Format -------------- -For example after the test, The result will display as the following format - -:: - - { u'64': { u'AverageLatency': 0.063, - u'Bandwidth': 0.239, - u'CPU': 0.0, - u'Duration': 20, - u'MaximumLatency': 0.063, - u'MinimumLatency': 0.063, - u'MppspGhz': 0, - u'OfferedLoad': 100.0, - u'PercentLoss': 22.42, - u'RxFrameCount': 4309750.0, - u'RxMbps': 198.28, - u'TxFrameCount': 5555436.0, - u'TxMbps': 230.03}} - -Option Description ------------------- -+---------------------+---------------------------------------------------+ -| Option Name | Description | -+=====================+===================================================+ -| AverageLatency | The average latency data during the packet | -| | transmission (Unit:microsecond) | -+---------------------+---------------------------------------------------+ -| Bandwidth | Network bandwidth(Unit:Million packets per second)| -+---------------------+---------------------------------------------------+ -| CPU | Total Resource Cpu usage(Unit: Ghz) | -+---------------------+---------------------------------------------------+ -| Duration | Test time(Unit: second) | -+---------------------+---------------------------------------------------+ -| MaximumLatency | The maximum packet latency during the packet | -| | transmission (Unit:microsecond) | -+---------------------+---------------------------------------------------+ -| MinimumLatency | The maximum packet latency during the packet | -| | transmission (Unit:microsecond) | -+---------------------+---------------------------------------------------+ -| MppspGhz | Million Packets per second with per CPU | -| | resource Ghz(Unit: Mpps/Ghz) | -+---------------------+---------------------------------------------------+ -| OfferedLoad | The load of network offered | -+---------------------+---------------------------------------------------+ -| PercentLoss | The percent of frame loss rate | -+---------------------+---------------------------------------------------+ -| RxFrameCount | The total frame on Nic rx | -+---------------------+---------------------------------------------------+ -| RxMbps | The received bandwidth per second | -+---------------------+---------------------------------------------------+ -| TxFrameCount | The total frame on Nic rx | -+---------------------+---------------------------------------------------+ -| TxMbps | The send bandwidth per second | -+---------------------+---------------------------------------------------+ diff --git a/docs/testing/developer/devguide/dashboard_guide.rst b/docs/testing/user/userguide/dashboard_guide.rst similarity index 100% rename from docs/testing/developer/devguide/dashboard_guide.rst rename to docs/testing/user/userguide/dashboard_guide.rst diff --git a/docs/testing/user/userguide/deprecated.rst b/docs/testing/user/userguide/deprecated.rst deleted file mode 100644 index 80fe44af..00000000 --- a/docs/testing/user/userguide/deprecated.rst +++ /dev/null @@ -1,28 +0,0 @@ -.. This work is licensed under a Creative Commons Attribution 4.0 International License. -.. http://creativecommons.org/licenses/by/4.0 - -*********************************** -Bottlenecks - Deprecated Test Cases -*********************************** - -.. This index.rst file is used to structure and organise the content in these directories. -.. The documentation toolchain will create web and pdf versions of the content of this file. - -.. toctree:: - :maxdepth: 1 - - ./rubbos/rubbos_basic.rst - ./rubbos/rubbos_tc1101.rst - ./rubbos/rubbos_tc1201.rst - ./rubbos/rubbos_tc1301.rst - ./rubbos/rubbos_tc1401.rst - ./rubbos/rubbos_heavy_tc1101.rst - ./vstf/vstf_Ti1.rst - ./vstf/vstf_Ti2.rst - ./vstf/vstf_Ti3.rst - ./vstf/vstf_Tn1.rst - ./vstf/vstf_Tn2.rst - ./vstf/vstf_Tu1.rst - ./vstf/vstf_Tu2.rst - ./vstf/vstf_Tu3.rst - diff --git a/docs/testing/user/userguide/index.rst b/docs/testing/user/userguide/index.rst index 795530d6..8e959abc 100644 --- a/docs/testing/user/userguide/index.rst +++ b/docs/testing/user/userguide/index.rst @@ -1,17 +1,16 @@ .. This work is licensed under a Creative Commons Attribution 4.0 International License. .. http://creativecommons.org/licenses/by/4.0 +.. (c) Huawei Technologies Co.,Ltd and others. -************************** -Bottlenecks - User Guide -************************** - -.. This index.rst file is used to structure and organise the content in these directories. -.. The documentation toolchain will create web and pdf versions of the content of this file. +*************************** +Bottlenecks - Testing Guide +*************************** .. toctree:: :maxdepth: 1 - ./posca/posca_stress_ping.rst - ./posca/posca_stress_traffic.rst - ./deprecated.rst + ./overview.rst + ./posca_guide.rst + ./dashboard_guide.rst + ./test_cases.rst diff --git a/docs/testing/developer/devguide/overview.rst b/docs/testing/user/userguide/overview.rst similarity index 91% rename from docs/testing/developer/devguide/overview.rst rename to docs/testing/user/userguide/overview.rst index f2e8bff1..a9302297 100644 --- a/docs/testing/developer/devguide/overview.rst +++ b/docs/testing/user/userguide/overview.rst @@ -6,10 +6,10 @@ Project Testing Guide ********************* -For each *test suite*, you can either setup *test story* or *test case* to run -certain test. *test story* could include several *test cases* as a set in one -configuration file. You could then call the *test story* or *test case* by using -Bottlencks CLI or Python build process. +For each *testsuite*, you can either setup *teststory* or *testcase* to run +certain test. *teststory* comprises several *testcases* as a set in one +configuration file. You could call *teststory* or *testcase* by using +Bottlencks user interfaces. Details will be shown in the following section. Brief Introdcution of the Test suites in Project Releases diff --git a/docs/testing/user/userguide/posca/posca_stress_ping.rst b/docs/testing/user/userguide/posca/posca_factor_ping.rst similarity index 100% rename from docs/testing/user/userguide/posca/posca_stress_ping.rst rename to docs/testing/user/userguide/posca/posca_factor_ping.rst diff --git a/docs/testing/user/userguide/posca/posca_stress_traffic.rst b/docs/testing/user/userguide/posca/posca_factor_system_bandwidth.rst similarity index 100% rename from docs/testing/user/userguide/posca/posca_stress_traffic.rst rename to docs/testing/user/userguide/posca/posca_factor_system_bandwidth.rst diff --git a/docs/testing/developer/devguide/posca_guide.rst b/docs/testing/user/userguide/posca_guide.rst similarity index 100% rename from docs/testing/developer/devguide/posca_guide.rst rename to docs/testing/user/userguide/posca_guide.rst diff --git a/docs/testing/user/userguide/rubbos/rubbos_basic.rst b/docs/testing/user/userguide/rubbos/rubbos_basic.rst deleted file mode 100644 index ffef6c48..00000000 --- a/docs/testing/user/userguide/rubbos/rubbos_basic.rst +++ /dev/null @@ -1,30 +0,0 @@ -.. This work is licensed under a Creative Commons Attribution 4.0 International -.. License. -.. http://creativecommons.org/licenses/by/4.0 -.. (c) OPNFV, Huawei Tech and others. - -************************************************ -Bottlenecks Rubbos Test Case Description Basic -************************************************ - - -+-----------------------------------------------------------------------------+ -|Bottlenecks Rubbos Basic | -| | -+--------------+--------------------------------------------------------------+ -|test case name| opnfv_bottlenecks_rubbos_Basic | -| | | -+--------------+--------------------------------------------------------------+ -|description | Rubbos platform for 1 tomcat, 1 Apache and 1 mysql. | -| | | -+--------------+--------------------------------------------------------------+ -|configuration | config file: | -| | /testsuite/rubbos/testcase_cfg/rubbos_basic.yaml | -| | | -| | client number: 1 | -| | | -+--------------+--------------------------------------------------------------+ -|test result | throughput | -| | | -+--------------+--------------------------------------------------------------+ - diff --git a/docs/testing/user/userguide/rubbos/rubbos_heavy_tc1101.rst b/docs/testing/user/userguide/rubbos/rubbos_heavy_tc1101.rst deleted file mode 100644 index 08251c7b..00000000 --- a/docs/testing/user/userguide/rubbos/rubbos_heavy_tc1101.rst +++ /dev/null @@ -1,30 +0,0 @@ -.. This work is licensed under a Creative Commons Attribution 4.0 International -.. License. -.. http://creativecommons.org/licenses/by/4.0 -.. (c) OPNFV, Huawei Tech and others. - -****************************************************** -Bottlenecks Rubbos Test Case Description Heavy TC1101 -****************************************************** - - -+-----------------------------------------------------------------------------+ -|Bottlenecks Rubbos TC Heavy1101 | -| | -+--------------+--------------------------------------------------------------+ -|test case name| opnfv_bottlenecks_rubbos_heavy_tc1101 | -| | | -+--------------+--------------------------------------------------------------+ -|description | Rubbos platform for 1 tomcat, 1 Apache and 1 mysql. | -| | | -+--------------+--------------------------------------------------------------+ -|configuration | config file: | -| | /testsuite/rubbos/testcase_cfg/rubbos-heavy_1-1-0-1.yaml | -| | | -| | client number: 10 | -| | | -+--------------+--------------------------------------------------------------+ -|test result | throughput | -| | | -+--------------+--------------------------------------------------------------+ - diff --git a/docs/testing/user/userguide/rubbos/rubbos_tc1101.rst b/docs/testing/user/userguide/rubbos/rubbos_tc1101.rst deleted file mode 100644 index 2a261313..00000000 --- a/docs/testing/user/userguide/rubbos/rubbos_tc1101.rst +++ /dev/null @@ -1,30 +0,0 @@ -.. This work is licensed under a Creative Commons Attribution 4.0 International -.. License. -.. http://creativecommons.org/licenses/by/4.0 -.. (c) OPNFV, Huawei Tech and others. - -************************************************ -Bottlenecks Rubbos Test Case Description TC1101 -************************************************ - - -+-----------------------------------------------------------------------------+ -|Bottlenecks Rubbos TC1101 | -| | -+--------------+--------------------------------------------------------------+ -|test case name| opnfv_bottlenecks_rubbos_tc1101 | -| | | -+--------------+--------------------------------------------------------------+ -|description | Rubbos platform for 1 tomcat, 1 Apache and 1 mysql. | -| | | -+--------------+--------------------------------------------------------------+ -|configuration | config file: | -| | /testsuite/rubbos/testcase_cfg/rubbos_1-1-0-1.yaml | -| | | -| | client number: 5 | -| | | -+--------------+--------------------------------------------------------------+ -|test result | throughput | -| | | -+--------------+--------------------------------------------------------------+ - diff --git a/docs/testing/user/userguide/rubbos/rubbos_tc1201.rst b/docs/testing/user/userguide/rubbos/rubbos_tc1201.rst deleted file mode 100644 index 9b6a5f99..00000000 --- a/docs/testing/user/userguide/rubbos/rubbos_tc1201.rst +++ /dev/null @@ -1,30 +0,0 @@ -.. This work is licensed under a Creative Commons Attribution 4.0 International -.. License. -.. http://creativecommons.org/licenses/by/4.0 -.. (c) OPNFV, Huawei Tech and others. - -************************************************ -Bottlenecks Rubbos Test Case Description TC1201 -************************************************ - - -+-----------------------------------------------------------------------------+ -|Bottlenecks Rubbos TC1201 | -| | -+--------------+--------------------------------------------------------------+ -|test case name| opnfv_bottlenecks_rubbos_tc1201 | -| | | -+--------------+--------------------------------------------------------------+ -|description | Rubbos platform for 1 Apache, 2 tomcat and 1 mysql. | -| | | -+--------------+--------------------------------------------------------------+ -|configuration | config file: | -| | /testsuite/rubbos/testcase_cfg/rubbos_1-2-0-1.yaml | -| | | -| | client number: 5 | -| | | -+--------------+--------------------------------------------------------------+ -|test result | throughput | -| | | -+--------------+--------------------------------------------------------------+ - diff --git a/docs/testing/user/userguide/rubbos/rubbos_tc1301.rst b/docs/testing/user/userguide/rubbos/rubbos_tc1301.rst deleted file mode 100644 index db4e0b63..00000000 --- a/docs/testing/user/userguide/rubbos/rubbos_tc1301.rst +++ /dev/null @@ -1,30 +0,0 @@ -.. This work is licensed under a Creative Commons Attribution 4.0 International -.. License. -.. http://creativecommons.org/licenses/by/4.0 -.. (c) OPNFV, Huawei Tech and others. - -************************************************ -Bottlenecks Rubbos Test Case Description TC1301 -************************************************ - - -+-----------------------------------------------------------------------------+ -|Bottlenecks Rubbos TC1301 | -| | -+--------------+--------------------------------------------------------------+ -|test case name| opnfv_bottlenecks_rubbos_tc1301 | -| | | -+--------------+--------------------------------------------------------------+ -|description | Rubbos platform for 1 Apache, 3 tomcat and 1 mysql. | -| | | -+--------------+--------------------------------------------------------------+ -|configuration | config file: | -| | /testsuite/rubbos/testcase_cfg/rubbos_1-3-0-1.yaml | -| | | -| | client number: 5 | -| | | -+--------------+--------------------------------------------------------------+ -|test result | throughput | -| | | -+--------------+--------------------------------------------------------------+ - diff --git a/docs/testing/user/userguide/rubbos/rubbos_tc1401.rst b/docs/testing/user/userguide/rubbos/rubbos_tc1401.rst deleted file mode 100644 index f195d237..00000000 --- a/docs/testing/user/userguide/rubbos/rubbos_tc1401.rst +++ /dev/null @@ -1,30 +0,0 @@ -.. This work is licensed under a Creative Commons Attribution 4.0 International -.. License. -.. http://creativecommons.org/licenses/by/4.0 -.. (c) OPNFV, Huawei Tech and others. - -************************************************ -Bottlenecks Rubbos Test Case Description TC1401 -************************************************ - - -+-----------------------------------------------------------------------------+ -|Bottlenecks Rubbos TC1401 | -| | -+--------------+--------------------------------------------------------------+ -|test case name| opnfv_bottlenecks_rubbos_tc1401 | -| | | -+--------------+--------------------------------------------------------------+ -|description | Rubbos platform for 1 Apache, 4 tomcat and 1 mysql. | -| | | -+--------------+--------------------------------------------------------------+ -|configuration | config file: | -| | /testsuite/rubbos/testcase_cfg/rubbos_1-4-0-1.yaml | -| | | -| | client number: 5 | -| | | -+--------------+--------------------------------------------------------------+ -|test result | throughput | -| | | -+--------------+--------------------------------------------------------------+ - diff --git a/docs/testing/developer/devguide/deprecated.rst b/docs/testing/user/userguide/test_cases.rst similarity index 57% rename from docs/testing/developer/devguide/deprecated.rst rename to docs/testing/user/userguide/test_cases.rst index 1566f38c..57e338e9 100644 --- a/docs/testing/developer/devguide/deprecated.rst +++ b/docs/testing/user/userguide/test_cases.rst @@ -2,14 +2,12 @@ .. http://creativecommons.org/licenses/by/4.0 .. (c) Huawei Technologies Co.,Ltd and others. -************************************** -Bottlenecks - Deprecated Testing Guide -************************************** - +************************ +Bottlenecks - Test Cases +************************ .. toctree:: :maxdepth: 1 - ./rubbos_guide.rst - ./vstf_guide.rst - + ./posca/posca_factor_system_bandwidth.rst + ./posca/posca_factor_ping.rst diff --git a/docs/testing/user/userguide/vstf/vstf_Ti1.rst b/docs/testing/user/userguide/vstf/vstf_Ti1.rst deleted file mode 100644 index ce1690b4..00000000 --- a/docs/testing/user/userguide/vstf/vstf_Ti1.rst +++ /dev/null @@ -1,28 +0,0 @@ -.. This work is licensed under a Creative Commons Attribution 4.0 International -.. License. -.. http://creativecommons.org/licenses/by/4.0 -.. (c) OPNFV, Huawei Tech and others. - -******************************************************************* -Bottlenecks vSwitch Test Framework(VSTF) Test Case Description Ti1 -******************************************************************* - - -+-----------------------------------------------------------------------------+ -|Bottlenecks VSTF Ti1 | -| | -+--------------+--------------------------------------------------------------+ -|test case name| opnfv_bottlenecks_vstf_Ti1 | -| | | -+--------------+--------------------------------------------------------------+ -|description | vSwitch test Ti1. | -| | | -+--------------+--------------------------------------------------------------+ -|configuration | config file: | -| | /testsuite/vstf/testcase_cfg/vstf_Ti1.yaml | -| | | -+--------------+--------------------------------------------------------------+ -|test result | throughput & latency | -| | | -+--------------+--------------------------------------------------------------+ - diff --git a/docs/testing/user/userguide/vstf/vstf_Ti2.rst b/docs/testing/user/userguide/vstf/vstf_Ti2.rst deleted file mode 100644 index 58cb40f7..00000000 --- a/docs/testing/user/userguide/vstf/vstf_Ti2.rst +++ /dev/null @@ -1,28 +0,0 @@ -.. This work is licensed under a Creative Commons Attribution 4.0 International -.. License. -.. http://creativecommons.org/licenses/by/4.0 -.. (c) OPNFV, Huawei Tech and others. - -******************************************************************* -Bottlenecks vSwitch Test Framework(VSTF) Test Case Description Ti2 -******************************************************************* - - -+-----------------------------------------------------------------------------+ -|Bottlenecks VSTF Ti2 | -| | -+--------------+--------------------------------------------------------------+ -|test case name| opnfv_bottlenecks_vstf_Ti2 | -| | | -+--------------+--------------------------------------------------------------+ -|description | vSwitch test Ti2. | -| | | -+--------------+--------------------------------------------------------------+ -|configuration | config file: | -| | /testsuite/vstf/testcase_cfg/vstf_Ti2.yaml | -| | | -+--------------+--------------------------------------------------------------+ -|test result | throughput & latency | -| | | -+--------------+--------------------------------------------------------------+ - diff --git a/docs/testing/user/userguide/vstf/vstf_Ti3.rst b/docs/testing/user/userguide/vstf/vstf_Ti3.rst deleted file mode 100644 index 3bb9dfce..00000000 --- a/docs/testing/user/userguide/vstf/vstf_Ti3.rst +++ /dev/null @@ -1,28 +0,0 @@ -.. This work is licensed under a Creative Commons Attribution 4.0 International -.. License. -.. http://creativecommons.org/licenses/by/4.0 -.. (c) OPNFV, Huawei Tech and others. - -******************************************************************* -Bottlenecks vSwitch Test Framework(VSTF) Test Case Description Ti3 -******************************************************************* - - -+-----------------------------------------------------------------------------+ -|Bottlenecks VSTF Ti3 | -| | -+--------------+--------------------------------------------------------------+ -|test case name| opnfv_bottlenecks_vstf_Ti3 | -| | | -+--------------+--------------------------------------------------------------+ -|description | vSwitch test Ti3. | -| | | -+--------------+--------------------------------------------------------------+ -|configuration | config file: | -| | /testsuite/vstf/testcase_cfg/vstf_Ti3.yaml | -| | | -+--------------+--------------------------------------------------------------+ -|test result | throughput & latency | -| | | -+--------------+--------------------------------------------------------------+ - diff --git a/docs/testing/user/userguide/vstf/vstf_Tn1.rst b/docs/testing/user/userguide/vstf/vstf_Tn1.rst deleted file mode 100644 index 5c591a9b..00000000 --- a/docs/testing/user/userguide/vstf/vstf_Tn1.rst +++ /dev/null @@ -1,28 +0,0 @@ -.. This work is licensed under a Creative Commons Attribution 4.0 International -.. License. -.. http://creativecommons.org/licenses/by/4.0 -.. (c) OPNFV, Huawei Tech and others. - -******************************************************************* -Bottlenecks vSwitch Test Framework(VSTF) Test Case Description Tn1 -******************************************************************* - - -+-----------------------------------------------------------------------------+ -|Bottlenecks VSTF Tn1 | -| | -+--------------+--------------------------------------------------------------+ -|test case name| opnfv_bottlenecks_vstf_Tn1 | -| | | -+--------------+--------------------------------------------------------------+ -|description | vSwitch test Tn1. | -| | | -+--------------+--------------------------------------------------------------+ -|configuration | config file: | -| | /testsuite/vstf/testcase_cfg/vstf_Tn1.yaml | -| | | -+--------------+--------------------------------------------------------------+ -|test result | throughput & latency | -| | | -+--------------+--------------------------------------------------------------+ - diff --git a/docs/testing/user/userguide/vstf/vstf_Tn2.rst b/docs/testing/user/userguide/vstf/vstf_Tn2.rst deleted file mode 100644 index 4b6d0c45..00000000 --- a/docs/testing/user/userguide/vstf/vstf_Tn2.rst +++ /dev/null @@ -1,28 +0,0 @@ -.. This work is licensed under a Creative Commons Attribution 4.0 International -.. License. -.. http://creativecommons.org/licenses/by/4.0 -.. (c) OPNFV, Huawei Tech and others. - -******************************************************************* -Bottlenecks vSwitch Test Framework(VSTF) Test Case Description Tn2 -******************************************************************* - - -+-----------------------------------------------------------------------------+ -|Bottlenecks VSTF Tn2 | -| | -+--------------+--------------------------------------------------------------+ -|test case name| opnfv_bottlenecks_vstf_Tn2 | -| | | -+--------------+--------------------------------------------------------------+ -|description | vSwitch test Tn2. | -| | | -+--------------+--------------------------------------------------------------+ -|configuration | config file: | -| | /testsuite/vstf/testcase_cfg/vstf_Tn2.yaml | -| | | -+--------------+--------------------------------------------------------------+ -|test result | throughput & latency | -| | | -+--------------+--------------------------------------------------------------+ - diff --git a/docs/testing/user/userguide/vstf/vstf_Tu1.rst b/docs/testing/user/userguide/vstf/vstf_Tu1.rst deleted file mode 100644 index cf27bb25..00000000 --- a/docs/testing/user/userguide/vstf/vstf_Tu1.rst +++ /dev/null @@ -1,28 +0,0 @@ -.. This work is licensed under a Creative Commons Attribution 4.0 International -.. License. -.. http://creativecommons.org/licenses/by/4.0 -.. (c) OPNFV, Huawei Tech and others. - -******************************************************************* -Bottlenecks vSwitch Test Framework(VSTF) Test Case Description Tu1 -******************************************************************* - - -+-----------------------------------------------------------------------------+ -|Bottlenecks VSTF Tu1 | -| | -+--------------+--------------------------------------------------------------+ -|test case name| opnfv_bottlenecks_vstf_Tu1 | -| | | -+--------------+--------------------------------------------------------------+ -|description | vSwitch test Tu1. | -| | | -+--------------+--------------------------------------------------------------+ -|configuration | config file: | -| | /testsuite/vstf/testcase_cfg/vstf_Tu1.yaml | -| | | -+--------------+--------------------------------------------------------------+ -|test result | throughput & latency | -| | | -+--------------+--------------------------------------------------------------+ - diff --git a/docs/testing/user/userguide/vstf/vstf_Tu2.rst b/docs/testing/user/userguide/vstf/vstf_Tu2.rst deleted file mode 100644 index 2ae84467..00000000 --- a/docs/testing/user/userguide/vstf/vstf_Tu2.rst +++ /dev/null @@ -1,28 +0,0 @@ -.. This work is licensed under a Creative Commons Attribution 4.0 International -.. License. -.. http://creativecommons.org/licenses/by/4.0 -.. (c) OPNFV, Huawei Tech and others. - -******************************************************************* -Bottlenecks vSwitch Test Framework(VSTF) Test Case Description Tu2 -******************************************************************* - - -+-----------------------------------------------------------------------------+ -|Bottlenecks VSTF Tu2 | -| | -+--------------+--------------------------------------------------------------+ -|test case name| opnfv_bottlenecks_vstf_Tu2 | -| | | -+--------------+--------------------------------------------------------------+ -|description | vSwitch test Tu2. | -| | | -+--------------+--------------------------------------------------------------+ -|configuration | config file: | -| | /testsuite/vstf/testcase_cfg/vstf_Tu2.yaml | -| | | -+--------------+--------------------------------------------------------------+ -|test result | throughput & latency | -| | | -+--------------+--------------------------------------------------------------+ - diff --git a/docs/testing/user/userguide/vstf/vstf_Tu3.rst b/docs/testing/user/userguide/vstf/vstf_Tu3.rst deleted file mode 100644 index 4e090f17..00000000 --- a/docs/testing/user/userguide/vstf/vstf_Tu3.rst +++ /dev/null @@ -1,28 +0,0 @@ -.. This work is licensed under a Creative Commons Attribution 4.0 International -.. License. -.. http://creativecommons.org/licenses/by/4.0 -.. (c) OPNFV, Huawei Tech and others. - -******************************************************************* -Bottlenecks vSwitch Test Framework(VSTF) Test Case Description Tu3 -******************************************************************* - - -+-----------------------------------------------------------------------------+ -|Bottlenecks VSTF Tu3 | -| | -+--------------+--------------------------------------------------------------+ -|test case name| opnfv_bottlenecks_vstf_Tu3 | -| | | -+--------------+--------------------------------------------------------------+ -|description | vSwitch test Tu3. | -| | | -+--------------+--------------------------------------------------------------+ -|configuration | config file: | -| | /testsuite/vstf/testcase_cfg/vstf_Tu3.yaml | -| | | -+--------------+--------------------------------------------------------------+ -|test result | throughput & latency | -| | | -+--------------+--------------------------------------------------------------+ - diff --git a/run_tests.sh b/run_tests.sh index 41104208..b92e9f29 100755 --- a/run_tests.sh +++ b/run_tests.sh @@ -109,7 +109,7 @@ function run_test(){ docker pull tutum/influxdb:0.13 sleep 5 info "Running posca $test_level: $test_exec" - docker exec bottleneckcompose_bottlenecks_1 python ${POSCA_SUITE}/run_posca.py $test_level $test_exec $REPORT + docker exec bottleneckcompose_bottlenecks_1 python ${POSCA_SUITE}/../run_testsuite.py $test_level $test_exec $REPORT ;; esac } diff --git a/testsuites/posca/testcase_cfg/posca_factor_ping.yaml b/testsuites/posca/testcase_cfg/posca_factor_ping.yaml index 7e6bf027..ed1e3475 100644 --- a/testsuites/posca/testcase_cfg/posca_factor_ping.yaml +++ b/testsuites/posca/testcase_cfg/posca_factor_ping.yaml @@ -19,13 +19,13 @@ load_manager: num_stack: 5, 10, 20 package_loss: 10% - contexts: + runners: stack_create: yardstick flavor: - yardstick_test_ip: yardstick_test_dir: "samples" yardstick_testcase: "ping_bottlenecks" -dashboard: - dashboard: "y" - dashboard_ip: +contexts: + dashboard: "Bottlenecks-ELK" + yardstick: "Bottlenecks-Yardstick" + yardstick_envpre: True diff --git a/testsuites/posca/testcase_script/posca_factor_ping.py b/testsuites/posca/testcase_script/posca_factor_ping.py index 732422ea..5f56cdae 100644 --- a/testsuites/posca/testcase_script/posca_factor_ping.py +++ b/testsuites/posca/testcase_script/posca_factor_ping.py @@ -15,13 +15,15 @@ import utils.logger as log import uuid import json import os +import time import multiprocessing -import docker import datetime from utils.parser import Parser as conf_parser import utils.env_prepare.quota_prepare as quota_prepare import utils.env_prepare.stack_prepare as stack_prepare + import testsuites.posca.testcase_dashboard.posca_stress_ping as DashBoard +import utils.infra_setup.runner.docker_env as docker_env # -------------------------------------------------- # logging configuration # -------------------------------------------------- @@ -40,34 +42,44 @@ testfile = os.path.basename(__file__) testcase, file_format = os.path.splitext(testfile) -def env_pre(con_dic): - stack_prepare._prepare_env_daemon() +def env_pre(test_config): + test_yardstick = False + if "yardstick" in test_config["contexts"].keys(): + test_yardstick = True + stack_prepare._prepare_env_daemon(test_yardstick) quota_prepare.quota_env_prepare() - client = docker.from_env() - con = client.containers.get('bottleneckcompose_yardstick_1') cmd = ('yardstick env prepare') LOG.info("yardstick envrionment prepare!") - stdout = con.exec_run(cmd) - LOG.debug(stdout) + if(test_config["contexts"]['yardstick_envpre']): + yardstick_container = docker_env.yardstick_info['container'] + stdout = docker_env.docker_exec_cmd(yardstick_container, cmd) + LOG.debug(stdout) def do_test(test_config, con_dic): out_file = ("/tmp/yardstick_" + str(uuid.uuid4()) + ".out") - client = docker.from_env() - con = client.containers.get('bottleneckcompose_yardstick_1') + yardstick_container = docker_env.yardstick_info['container'] cmd = ('yardstick task start /home/opnfv/repos/yardstick/' 'samples/ping_bottlenecks.yaml --output-file ' + out_file) - stdout = con.exec_run(cmd) - LOG.debug(stdout) - with open(out_file) as f: - data = json.load(f) - if data["status"] == 1: - LOG.info("yardstick run success") - out_value = 1 - else: - LOG.error("yardstick error exit") - out_value = 0 - os.remove(out_file) + stdout = docker_env.docker_exec_cmd(yardstick_container, cmd) + LOG.info(stdout) + out_value = 0 + loop_walue = 0 + while loop_walue < 150: + time.sleep(2) + with open(out_file) as f: + loop_walue = loop_walue + 1 + data = json.load(f) + if data["status"] == 1: + if data["result"]["criteria"] == "PASS": + LOG.info("yardstick run success") + out_value = 1 + else: + LOG.error("task error exit") + out_value = 0 + break + elif data["status"] == 2: + LOG.error("yardstick error exit") return out_value @@ -92,19 +104,19 @@ def func_run(condic): def run(test_config): con_dic = test_config["load_manager"] test_num = con_dic['scenarios']['num_stack'].split(',') - if con_dic["contexts"]["yardstick_test_ip"] is None: - con_dic["contexts"]["yardstick_test_ip"] =\ + if test_config["contexts"]["yardstick_ip"] is None: + con_dic["contexts"]["yardstick_ip"] =\ conf_parser.ip_parser("yardstick_test_ip") - if test_config["dashboard"]["dashboard"] == 'y': - if test_config["dashboard"]["dashboard_ip"] is None: - test_config["dashboard"]["dashboard_ip"] =\ + if "dashboard" in test_config["contexts"].keys(): + if test_config["contexts"]["dashboard_ip"] is None: + test_config["contexts"]["dashboard_ip"] =\ conf_parser.ip_parser("dashboard") LOG.info("Create Dashboard data") - DashBoard.posca_stress_ping(test_config["dashboard"]) + DashBoard.posca_stress_ping(test_config["contexts"]) LOG.info("bottlenecks envrionment prepare!") - env_pre(con_dic) + env_pre(test_config) LOG.info("yardstick envrionment prepare done!") for value in test_num: @@ -127,8 +139,8 @@ def run(test_config): during_date = (endtime - starttime).seconds data_reply = config_to_result(num, out_num, during_date) - if test_config['dashboard']['dashboard'] == 'y': - DashBoard.dashboard_send_data(test_config['dashboard'], data_reply) + if "dashboard" in test_config["contexts"].keys(): + DashBoard.dashboard_send_data(test_config['contexts'], data_reply) conf_parser.result_to_file(data_reply, test_config["out_file"]) if out_num < num: diff --git a/testsuites/posca/run_posca.py b/testsuites/run_testsuite.py old mode 100755 new mode 100644 similarity index 71% rename from testsuites/posca/run_posca.py rename to testsuites/run_testsuite.py index b1dba140..7ec67eff --- a/testsuites/posca/run_posca.py +++ b/testsuites/run_testsuite.py @@ -7,7 +7,7 @@ # which accompanies this distribution, and is available at # http://www.apache.org/licenses/LICENSE-2.0 ############################################################################## -'''This file realize the function of how to run posca. +'''This file realize the function of how to run testsuite. In this file, The first thing is to read testcase config for example: you could run this by use posca_run('testcase', "Which testcase you will run") @@ -21,11 +21,13 @@ import os from oslo_serialization import jsonutils import json +import time import requests import datetime import utils.parser as conf_parser import utils.logger as log +import utils.infra_setup.runner.docker_env as docker_env INTERPRETER = "/usr/bin/python" LOG = log.Logger(__name__).getLogger() @@ -34,9 +36,10 @@ LOG = log.Logger(__name__).getLogger() # ------------------------------------------------------ -def posca_testcase_run(testcase_script, test_config): +def posca_testcase_run(testsuite, testcase_script, test_config): - module_string = "testsuites.posca.testcase_script.%s" % (testcase_script) + module_string = "testsuites.%s.testcase_script.%s" % (testsuite, + testcase_script) module = importlib.import_module(module_string) module.run(test_config) @@ -73,20 +76,37 @@ def report(testcase, start_date, stop_date, criteria, details_doc): LOG.exception('Failed to record result data: %s', err) -def posca_run(test_level, test_name, REPORT="False"): +def docker_env_prepare(config): + if 'contexts' in config.keys() and config["contexts"] is not None: + context_config = config["contexts"] + if 'yardstick' in context_config.keys() and \ + context_config["yardstick"] is not None: + docker_env.env_yardstick(context_config['yardstick']) + conf_parser.Parser.convert_docker_env(config, "yardstick") + if 'dashboard' in context_config.keys() and \ + context_config["dashboard"] is not None: + docker_env.env_elk(context_config['dashboard']) + conf_parser.Parser.convert_docker_env(config, "dashboard") + LOG.debug('Waiting for ELK init') + time.sleep(15) + return + + +def testsuite_run(test_level, test_name, REPORT="False"): + tester_parser = test_name.split("_") if test_level == "testcase": - config = conf_parser.Parser.testcase_read("posca", test_name) + config = conf_parser.Parser.testcase_read(tester_parser[0], test_name) elif test_level == "teststory": - config = conf_parser.Parser.story_read("posca", test_name) + config = conf_parser.Parser.story_read(tester_parser[0], test_name) for testcase in config: LOG.info("Begin to run %s testcase in POSCA testsuite", testcase) config[testcase]['out_file'] =\ conf_parser.Parser.testcase_out_dir(testcase) start_date = datetime.datetime.now() - posca_testcase_run(testcase, config[testcase]) + docker_env_prepare(config[testcase]) + posca_testcase_run(tester_parser[0], testcase, config[testcase]) stop_date = datetime.datetime.now() LOG.info("End of %s testcase in POSCA testsuite", testcase) - criteria = "FAIL" if REPORT == "True": details_doc = [] @@ -102,7 +122,7 @@ def main(): test_level = sys.argv[1] test_name = sys.argv[2] REPORT = sys.argv[3] - posca_run(test_level, test_name, REPORT) + testsuite_run(test_level, test_name, REPORT) if __name__ == '__main__': diff --git a/utils/env_prepare/quota_prepare.py b/utils/env_prepare/quota_prepare.py index e52a3e32..850a46a4 100644 --- a/utils/env_prepare/quota_prepare.py +++ b/utils/env_prepare/quota_prepare.py @@ -21,7 +21,8 @@ neutron_quota = {"subnet": -1, "floatingip": -1, "subnetpool": -1, "router": -1, - "port": -1} + "port": -1, + "security_group": -1} nova_quota = {"ram": -1, "cores": -1, diff --git a/utils/env_prepare/stack_prepare.py b/utils/env_prepare/stack_prepare.py index 3c706fad..ce8da619 100644 --- a/utils/env_prepare/stack_prepare.py +++ b/utils/env_prepare/stack_prepare.py @@ -13,25 +13,41 @@ import errno from utils.logger import Logger from utils.parser import Parser as config import utils.infra_setup.heat.manager as utils +import utils.infra_setup.runner.docker_env as docker_env LOG = Logger(__name__).getLogger() -def _prepare_env_daemon(): - - installer_ip = os.environ.get('INSTALLER_IP', 'undefined') - installer_type = os.environ.get('INSTALLER_TYPE', 'undefined') +def _prepare_env_daemon(test_yardstick): rc_file = config.bottlenecks_config["rc_dir"] - _get_remote_rc_file(rc_file, installer_ip, installer_type) + if not os.path.exists(rc_file): + installer_ip = os.environ.get('INSTALLER_IP', 'undefined') + installer_type = os.environ.get('INSTALLER_TYPE', 'undefined') + _get_remote_rc_file(rc_file, installer_ip, installer_type) _source_file(rc_file) - # _append_external_network(rc_file) + if not os.environ.get("EXTERNAL_NETWORK"): + _append_external_network(rc_file) + if test_yardstick: + cmd = "cp %s %s" % (rc_file, + config.bottlenecks_config["yardstick_rc_dir"]) + yardstick_contain = docker_env.yardstick_info["container"] + docker_env.docker_exec_cmd(yardstick_contain, + cmd) # update the external_network - # _source_file(rc_file) + _source_file(rc_file) + + +def file_copy(src_file, dest_file): + src = file(src_file, "r+") + des = file(dest_file, "w+") + des.writelines(src.read()) + src.close() + des.close() def _get_remote_rc_file(rc_file, installer_ip, installer_type): diff --git a/utils/infra_setup/runner/docker_env.py b/utils/infra_setup/runner/docker_env.py new file mode 100644 index 00000000..1e8728eb --- /dev/null +++ b/utils/infra_setup/runner/docker_env.py @@ -0,0 +1,121 @@ +#!/usr/bin/env python +############################################################################## +# Copyright (c) 2017 Huawei Technologies Co.,Ltd 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 +############################################################################## +'''This file contain some function about docker API. +At present, This file contain the following function: +1.Ask Docker service to create a docker(yardstick or ELK). +2.get a docker ip. +3.Remove a docker.''' + +import docker +import os +import socket + +yardstick_info = {} +ELK_info = {} + + +def get_client(): + client = docker.from_env() + return client + + +def docker_find(docker_name): + client = get_client() + docker_client = client.containers.get(docker_name) + return docker_client + + +def env_yardstick(docker_name): + client = get_client() + yardstick_info["name"] = docker_name + try: + env_docker = docker_find(docker_name) + yardstick_info["container"] = env_docker + yardstick_info["ip"] = get_docker_ip(docker_name) + return env_docker + except docker.errors.NotFound: + pass + volume = get_self_volume() + yardstick_tag = os.getenv("Yardstick_TAG") + if yardstick_tag is None: + yardstick_tag = "latest" + env_docker = client.containers.run(image="opnfv/yardstick:%s" + % yardstick_tag, + privileged=True, + tty=True, + detach=True, + ports={'5000': '8888'}, + volumes=volume, + name=docker_name) + yardstick_info["container"] = env_docker + yardstick_info["ip"] = get_docker_ip(docker_name) + return env_docker + + +def env_bottlenecks(docker_name): + client = get_client() + volume = get_self_volume() + env_docker = client.containers.run(image="opnfv/bottlenecks:latest", + privileged=True, + detach=True, + ports={'8888': '5000'}, + volumes=volume, + name=docker_name) + return env_docker + + +def env_elk(docker_name): + client = get_client() + ELK_info["name"] = docker_name + try: + env_docker = docker_find(docker_name) + ELK_info["container"] = env_docker + ELK_info["ip"] = get_docker_ip(docker_name) + return env_docker + except docker.errors.NotFound: + pass + env_docker = client.containers.run(image="sebp/elk:es241_l240_k461", + privileged=True, + detach=True, + ports={'5044': '5044', + '5601': '5601', + '9200': '9200'}, + name=docker_name) + ELK_info["container"] = env_docker + ELK_info["ip"] = get_docker_ip(docker_name) + return env_docker + + +def get_docker_ip(docker_name): + env_docker = docker_find(docker_name) + client = docker.APIClient(base_url='unix://var/run/docker.sock') + docker_inspect = client.inspect_container(env_docker.id) + ip_address = docker_inspect["NetworkSettings"]["IPAddress"] + return ip_address + + +def docker_exec_cmd(docker, cmd): + return docker.exec_run(cmd) + + +def get_self_volume(): + self_volume = {} + hostname = socket.gethostname() + client = docker.APIClient(base_url='unix://var/run/docker.sock') + volume = client.inspect_container(hostname)["Mounts"] + for i in volume: + self_volume[i['Source']] = i['Destination'] + return self_volume + + +def remove_docker(docker_name): + docker = docker_find(docker_name) + docker.kill() + docker.remove() diff --git a/utils/parser.py b/utils/parser.py index ad141acb..65072c06 100644 --- a/utils/parser.py +++ b/utils/parser.py @@ -17,6 +17,7 @@ import yaml import json import time from pyroute2 import IPDB +import utils.infra_setup.runner.docker_env as docker_env class Parser(): @@ -41,6 +42,8 @@ class Parser(): cls.bottlenecks_config["fetch_os"] = common_config["fetch_os_file"] cls.bottlenecks_config["log_dir"] = common_config['log_dir'] cls.bottlenecks_config["rc_dir"] = common_config['rc_dir'] + cls.bottlenecks_config["yardstick_rc_dir"] = \ + common_config['yardstick_rc_dir'] cls.config_dir_check(cls.bottlenecks_config["log_dir"]) @classmethod @@ -92,6 +95,15 @@ class Parser(): # TO-DO add cli parameters to stack_config. return test_cfg, stack_cfg + @staticmethod + def convert_docker_env(config, ip_type): + if ip_type is "dashboard": + config["contexts"]["dashboard_ip"] = \ + docker_env.ELK_info["ip"] + ":9200" + elif ip_type is "yardstick": + config["contexts"]["yardstick_ip"] = \ + docker_env.yardstick_info["ip"] + ":8888" + @staticmethod def ip_parser(ip_type): with IPDB() as ip: