Adjust directory structure 03/23003/8
authorwu.zhihui <wu.zhihui1@zte.com.cn>
Wed, 12 Oct 2016 07:32:52 +0000 (15:32 +0800)
committerwu.zhihui <wu.zhihui1@zte.com.cn>
Fri, 14 Oct 2016 09:16:00 +0000 (17:16 +0800)
qtip
  !
  +---- scripts
  !        !
  !        +----ref_result # python scripts to generate results report
  !        +----fetch_compute_ips.sh
  !        +----fetch_os_creds.sh
  !        +----file_permission.sh
  !        +----get_env_info.sh
  !        +----qtip_creds.sh
  !        +----ssh_exch.exp
  !
  +---- config
  !        !
  !        +---- Qtip_key
  !        +---- Qtip_key.pub
  !        +---- SampleHeat.yaml
  !
  +---- utils
  !        !
  !        +---- logger_utils.py
  !        +---- report # generate pdf report file

Change-Id: Ia908ff31494369c1a13fb88b1ff9b0e5681f8e29
Signed-off-by: wu.zhihui <wu.zhihui1@zte.com.cn>
30 files changed:
config/QtipKey [moved from data/QtipKey with 100% similarity]
config/QtipKey.pub [moved from data/QtipKey.pub with 100% similarity]
config/SampleHeat.yaml [moved from heat/SampleHeat.yaml with 100% similarity]
docker/run_qtip.sh
func/driver.py
func/env_setup.py
func/spawn_vm.py
scripts/fetch_compute_ips.sh [moved from data/fetch_compute_ips.sh with 100% similarity]
scripts/fetch_os_creds.sh [moved from data/fetch_os_creds.sh with 100% similarity]
scripts/file_permission.sh [moved from data/file_permission.sh with 100% similarity]
scripts/get_env_info.sh [moved from get_env_info.sh with 92% similarity]
scripts/qtip_creds.sh [moved from data/qtip_creds.sh with 100% similarity]
scripts/ref_results/__init__.py [moved from data/__init__.py with 100% similarity]
scripts/ref_results/compute_benchmarks_indices.py [moved from data/ref_results/compute_benchmarks_indices.py with 100% similarity]
scripts/ref_results/generator_ref_json.py [moved from data/ref_results/generator_ref_json.py with 100% similarity]
scripts/ref_results/index_calculation.py [moved from data/ref_results/index_calculation.py with 100% similarity]
scripts/ref_results/network_benchmarks_indices.py [moved from data/ref_results/network_benchmarks_indices.py with 100% similarity]
scripts/ref_results/reference.json [moved from data/ref_results/reference.json with 100% similarity]
scripts/ref_results/result_accum.py [moved from data/ref_results/result_accum.py with 100% similarity]
scripts/ref_results/storage_benchmarks_indices.py [moved from data/ref_results/storage_benchmarks_indices.py with 100% similarity]
scripts/ref_results/suite_result.py [moved from data/ref_results/suite_result.py with 100% similarity]
scripts/ssh_exch.exp [moved from data/ssh_exch.exp with 100% similarity]
setup.py
tests/ansible_api_test.py
tests/env_setup_test.py
utils/report/Qtip_Report.py [moved from data/report/Qtip_Report.py with 100% similarity]
utils/report/__init__.py [moved from data/ref_results/__init__.py with 100% similarity]
utils/report/get_indices.py [moved from data/report/get_indices.py with 100% similarity]
utils/report/get_results.py [moved from data/report/get_results.py with 100% similarity]
utils/report/qtip_graph.py [moved from data/report/qtip_graph.py with 100% similarity]

similarity index 100%
rename from data/QtipKey
rename to config/QtipKey
similarity index 100%
rename from data/QtipKey.pub
rename to config/QtipKey.pub
similarity index 100%
rename from heat/SampleHeat.yaml
rename to config/SampleHeat.yaml
index d766d46..62f97c8 100755 (executable)
@@ -3,21 +3,21 @@ run_test_suite()
 {
     if [ "$TEST_CASE" == "compute" ]; then
         cd ${QTIP_DIR}  && python qtip.py -l default -f compute
-        cd ${QTIP_DIR} && python data/ref_results/suite_result.py compute
+        cd ${QTIP_DIR} && python scripts/ref_results/suite_result.py compute
     elif [ "$TEST_CASE" == "storage" ]; then
         cd ${QTIP_DIR}  && python qtip.py -l default -f storage
-        cd ${QTIP_DIR} && python data/ref_results/suite_result.py storage
+        cd ${QTIP_DIR} && python scripts/ref_results/suite_result.py storage
     elif [ "$TEST_CASE" == "network" ]; then
         cd ${QTIP_DIR}  && python qtip.py -l default -f network
-        cd ${QTIP_DIR} && python data/ref_results/suite_result.py network
+        cd ${QTIP_DIR} && python scripts/ref_results/suite_result.py network
     elif [ "$TEST_CASE" == "all" ]; then
         cd ${QTIP_DIR}  && python qtip.py -l default -f compute
         cd ${QTIP_DIR}  && python qtip.py -l default -f storage
         cd ${QTIP_DIR}  && python qtip.py -l default -f network
 
-        cd ${QTIP_DIR} && python data/ref_results/suite_result.py compute
-        cd ${QTIP_DIR} && python data/ref_results/suite_result.py storage
-        cd ${QTIP_DIR} && python data/ref_results/suite_result.py network
+        cd ${QTIP_DIR} && python scripts/ref_results/suite_result.py compute
+        cd ${QTIP_DIR} && python scripts/ref_results/suite_result.py storage
+        cd ${QTIP_DIR} && python scripts/ref_results/suite_result.py network
     fi
 }
 
index bcda0ce..9a011c2 100644 (file)
@@ -64,9 +64,9 @@ class Driver:
     def run_ansible_playbook(self, benchmark, extra_vars):
         logger.info(extra_vars)
         ansible_api = AnsibleApi()
-        ansible_api.execute_playbook('./data/hosts',
+        ansible_api.execute_playbook('./config/hosts',
                                      './benchmarks/playbooks/{0}.yaml'.format(benchmark),
-                                     './data/QtipKey', extra_vars)
+                                     './config/QtipKey', extra_vars)
         return self.get_ansible_result(extra_vars['role'], ansible_api.get_detail_playbook_stats())
 
     def drive_bench(self, installer_type, pwd, benchmark, roles, benchmark_fname,
index 2655fab..9e21a5b 100644 (file)
@@ -46,7 +46,7 @@ class Env_setup:
 
     @staticmethod
     def write_to_file(role):
-        f_name_2 = open('./data/hosts', 'w')
+        f_name_2 = open('./config/hosts', 'w')
         print role.items()
         for k in role:
             f_name_2.write('[' + k + ']\n')
@@ -62,13 +62,13 @@ class Env_setup:
             os.system('ssh-keyscan %s >> /root/.ssh/known_hosts' % ip)
             time.sleep(2)
 
-            ssh_cmd = './data/qtip_creds.sh %s' % ip
+            ssh_cmd = './scripts/qtip_creds.sh %s' % ip
             logger.info("run command: %s " % ssh_cmd)
             os.system(ssh_cmd)
 
             ssh = paramiko.SSHClient()
             ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
-            ssh.connect(ip, key_filename='./data/QtipKey')
+            ssh.connect(ip, key_filename='./config/QtipKey')
 
             for attempts in range(100):
                 try:
@@ -109,7 +109,7 @@ class Env_setup:
         if not installer_ip:
             raise RuntimeError("undefine environment variable INSTALLER_IP")
 
-        cmd = "bash ./data/fetch_compute_ips.sh -i %s -a %s" % \
+        cmd = "bash ./scripts/fetch_compute_ips.sh -i %s -a %s" % \
             (installer_type, installer_ip)
         logger.info(cmd)
         os.system(cmd)
index c45af00..3a16e02 100644 (file)
@@ -65,15 +65,15 @@ class SpawnVM(Env_setup):
     def heat_template_vm(self, vm_params, installer):\r
         Heat_Dic = {}\r
         try:\r
-            with open('./heat/SampleHeat.yaml', 'r+') as H_temp:\r
+            with open('./config/SampleHeat.yaml', 'r+') as H_temp:\r
                 Heat_Dic = yaml.safe_load(H_temp)\r
         except yaml.YAMLError as exc:\r
             if hasattr(exc, 'problem_mark'):\r
                 mark = exc.problem_mark\r
-                print 'Error in qtip/heat/SampleHeat.yaml at: (%s,%s)' % (mark.line + 1, mark.column + 1)\r
+                print 'Error in qtip/config/SampleHeat.yaml at: (%s,%s)' % (mark.line + 1, mark.column + 1)\r
                 print 'EXITING PROGRAM. Correct File and restart'\r
                 sys.exit(1)\r
-        fopen = open('./data/QtipKey.pub', 'r')\r
+        fopen = open('./config/QtipKey.pub', 'r')\r
         fopenstr = fopen.read()\r
         fopenstr = fopenstr.rstrip()\r
         scriptcmd = '#!/bin/bash \n echo {0} >>  foo.txt \n echo {1} >> /root/.ssh/authorized_keys'.format(\r
@@ -243,7 +243,7 @@ class SpawnVM(Env_setup):
                 if i['output_key'] == 'KeyPair_PublicKey':\r
                     sshkey = str(i['output_value'])\r
 \r
-        with open('./data/my_key.pem', 'w') as fopen:\r
+        with open('./config/my_key.pem', 'w') as fopen:\r
             fopen.write(sshkey)\r
         fopen.close()\r
         print Env_setup.ip_pw_list\r
similarity index 92%
rename from get_env_info.sh
rename to scripts/get_env_info.sh
index 2fb0d22..4b362fa 100755 (executable)
@@ -34,4 +34,4 @@ if [ $INSTALLER_TYPE == "apex" ]
 fi
 
 
-./data/fetch_os_creds.sh -d ./opnfv-creds.sh
+./scripts/fetch_os_creds.sh -d ./opnfv-creds.sh
similarity index 100%
rename from data/qtip_creds.sh
rename to scripts/qtip_creds.sh
similarity index 100%
rename from data/ssh_exch.exp
rename to scripts/ssh_exch.exp
index 52874dd..85dc966 100644 (file)
--- a/setup.py
+++ b/setup.py
@@ -7,4 +7,4 @@ setup(name='qtip',
       py_modules=['qtip'],
       version='1.0',
       author='opnfv',
-      packages=['func', 'data.ref_results', 'data.report'])
+      packages=['func', 'scripts.ref_results', 'utils.report'])
index e9f0a77..613d5f7 100644 (file)
@@ -14,6 +14,6 @@ class TestClass:
         ansible_api = AnsibleApi()
         ret = ansible_api.execute_playbook('tests/data/hosts',
                                            'tests/data/test.yml',
-                                           'data/QtipKey',
+                                           'config/QtipKey',
                                            {'keys': 'test'})
         assert ret == 3
index cc3c6b6..a0bbf64 100644 (file)
@@ -64,7 +64,7 @@ class TestClass:
         test_class.fetch_compute_ips = mock_ips
         test_class.parse("tests/test_case/bm_without_proxy.yaml")
         test_class.update_ansible()
-        result = filecmp.cmp('tests/output/hosts', 'data/hosts')
+        result = filecmp.cmp('tests/output/hosts', 'config/hosts')
         assert result
 
     def test_ping(self, capfd):