aboutsummaryrefslogtreecommitdiffstats
path: root/legacy/utils
diff options
context:
space:
mode:
authorzhihui wu <wu.zhihui1@zte.com.cn>2018-03-13 09:56:09 +0800
committerzhihui wu <wu.zhihui1@zte.com.cn>2018-03-13 09:56:09 +0800
commit080dea3ed5dca2a72258811cf6522ed69b11ffff (patch)
tree1a2e8c197d2ca3222e04176294509bca47d13fc1 /legacy/utils
parent0e105924554824f9d08df24678e83e174fef2197 (diff)
Delete part of code under qtip/legacy
These code is obsolete. Change-Id: I0fc2b12847aaa30f713cf7578a92aae912153dd6 Signed-off-by: zhihui wu <wu.zhihui1@zte.com.cn>
Diffstat (limited to 'legacy/utils')
-rw-r--r--legacy/utils/__init__.py0
-rw-r--r--legacy/utils/create_zones.py86
-rw-r--r--legacy/utils/dashboard/__init__.py0
-rw-r--r--legacy/utils/dashboard/pushtoDB.py82
-rw-r--r--legacy/utils/report/__init__.py0
-rw-r--r--legacy/utils/report/get_indices.py16
-rw-r--r--legacy/utils/report/get_results.py58
-rw-r--r--legacy/utils/report/qtip_graph.py38
-rw-r--r--legacy/utils/report/qtip_report.py117
-rw-r--r--legacy/utils/spawn_vm.py206
-rw-r--r--legacy/utils/transform/__init__.py0
-rw-r--r--legacy/utils/transform/fio_transform.py37
-rw-r--r--legacy/utils/transform/iperf_transform.py35
13 files changed, 0 insertions, 675 deletions
diff --git a/legacy/utils/__init__.py b/legacy/utils/__init__.py
deleted file mode 100644
index e69de29b..00000000
--- a/legacy/utils/__init__.py
+++ /dev/null
diff --git a/legacy/utils/create_zones.py b/legacy/utils/create_zones.py
deleted file mode 100644
index 5e378c83..00000000
--- a/legacy/utils/create_zones.py
+++ /dev/null
@@ -1,86 +0,0 @@
-##############################################################################
-# Copyright (c) 2016 Dell Inc, ZTE 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
-##############################################################################
-from keystoneclient.auth.identity import v2
-from keystoneclient import session
-from novaclient import client
-import os
-import random
-import logger_utils
-
-logger = logger_utils.QtipLogger('create_zones').get
-
-
-class AvailabilityZone:
-
- def __init__(self):
- self._keystone_client = None
- self._nova_client = None
-
- def _get_keystone_client(self):
- """returns a keystone client instance"""
-
- if self._keystone_client is None:
- '''
- self._keystone_client = keystoneclient.v2_0.client.Client(
- auth_url=os.environ.get('OS_AUTH_URL'),
- username=os.environ.get('OS_USERNAME'),
- password=os.environ.get('OS_PASSWORD'),
- tenant_name=os.environ.get('OS_TENANT_NAME'))
- '''
- auth = v2.Password(auth_url=os.environ.get('OS_AUTH_URL'),
- username=os.environ.get('OS_USERNAME'),
- password=os.environ.get('OS_PASSWORD'),
- tenant_name=os.environ.get('OS_TENANT_NAME'))
-
- sess = session.Session(auth=auth)
- else:
- return self._keystone_client
-
- return sess
-
- def _get_nova_client(self):
- if self._nova_client is None:
- keystone = self._get_keystone_client()
- self._nova_client = client.Client('2', session=keystone)
- return self._nova_client
-
- def clean_all_aggregates(self):
- logger.info("clean all aggregates")
- nova = self._get_nova_client()
- agg_list = nova.aggregates.list()
-
- for agg in agg_list:
- agg_info = nova.aggregates.get_details(agg.id)
- agg_hosts = agg_info.hosts
- if len(agg_hosts):
- for host in agg_hosts:
- nova.aggregates.remove_host(agg.id, host)
- nova.aggregates.delete(agg.id)
-
- def create_aggs(self, args):
- azone_list = list(set(args))
- azone_list.sort()
-
- nova = self._get_nova_client()
- hyper_list = nova.hypervisors.list()
-
- if len(azone_list) > len(hyper_list):
- logger.error("required available zones > compute nodes")
- return None
-
- compute_nodes = map(lambda x: x.service['host'], hyper_list)
- sample_nodes = random.sample(compute_nodes, len(azone_list))
- sample_nodes.sort()
-
- for index, item in enumerate(azone_list):
- logger.info("create aggregates: %s" % str(item))
- agg_id = nova.aggregates.create(item, item)
-
- logger.info("add host: %s" % sample_nodes[index])
- nova.aggregates.add_host(aggregate=agg_id, host=sample_nodes[index])
diff --git a/legacy/utils/dashboard/__init__.py b/legacy/utils/dashboard/__init__.py
deleted file mode 100644
index e69de29b..00000000
--- a/legacy/utils/dashboard/__init__.py
+++ /dev/null
diff --git a/legacy/utils/dashboard/pushtoDB.py b/legacy/utils/dashboard/pushtoDB.py
deleted file mode 100644
index ce54aebd..00000000
--- a/legacy/utils/dashboard/pushtoDB.py
+++ /dev/null
@@ -1,82 +0,0 @@
-##############################################################################
-# Copyright (c) 2017 ZTE Corporation 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 requests
-import json
-import datetime
-import os
-import sys
-from qtip.utils import logger_utils
-
-logger = logger_utils.QtipLogger('push_db').get
-
-TEST_DB = 'http://testresults.opnfv.org/test/api/v1'
-
-suite_list = [('compute_result.json', 'compute_test_suite'),
- ('network_result.json', 'network_test_suite'),
- ('storage_result.json', 'storage_test_suite')]
-payload_list = {}
-
-
-def push_results_to_db(db_url, case_name, payload, installer, pod_name):
-
- url = db_url + "/results"
- creation_date = str(datetime.datetime.utcnow().isoformat())
-
- params = {"project_name": "qtip", "case_name": case_name,
- "pod_name": pod_name, "installer": installer, "start_date": creation_date,
- "version": "test", "details": payload}
-
- headers = {'Content-Type': 'application/json'}
- logger.info('pod_name:{0},installer:{1},creation_data:{2}'.format(pod_name,
- installer,
- creation_date))
- # temporary code, will be deleted after Bigergia dashboard is ready
- try:
- qtip_testapi_url = "http://testapi.qtip.openzero.net/results"
- qtip_testapi_r = requests.post(qtip_testapi_url, data=json.dumps(params), headers=headers)
- logger.info('Pushing Results to qtip_testapi: %s'.format(qtip_testapi_r))
- except:
- logger.info("Pushing Results to qtip_testapi Error:{0}".format(sys.exc_info()[0]))
-
- try:
- r = requests.post(url, data=json.dumps(params), headers=headers)
- logger.info(r)
- return True
- except:
- logger.info("Error:{0}".format(sys.exc_info()[0]))
- return False
-
-
-def populate_payload(suite_list):
-
- global payload_list
- for k, v in suite_list:
-
- if os.path.isfile('results/' + str(k)):
- payload_list[k] = v
-
-
-def main():
-
- global payload_list
- populate_payload(suite_list)
- if payload_list:
- logger.info(payload_list)
- for suite, case in payload_list.items():
- with open('results/' + suite, 'r') as result_file:
- j = json.load(result_file)
- push_results_to_db(TEST_DB, case, j,
- os.environ['INSTALLER_TYPE'],
- os.environ['NODE_NAME'])
- elif not payload_list:
- logger.info('Results not found')
-
-
-if __name__ == "__main__":
- main()
diff --git a/legacy/utils/report/__init__.py b/legacy/utils/report/__init__.py
deleted file mode 100644
index e69de29b..00000000
--- a/legacy/utils/report/__init__.py
+++ /dev/null
diff --git a/legacy/utils/report/get_indices.py b/legacy/utils/report/get_indices.py
deleted file mode 100644
index 42db6584..00000000
--- a/legacy/utils/report/get_indices.py
+++ /dev/null
@@ -1,16 +0,0 @@
-##############################################################################
-# Copyright (c) 2017 ZTE Corporation 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 json
-
-
-def get_index(suite):
- with open('../../results/' + suite + '.json') as result_file:
- result_djson = json.load(result_file)
- index = result_djson['index']
- return index
diff --git a/legacy/utils/report/get_results.py b/legacy/utils/report/get_results.py
deleted file mode 100644
index 6df88235..00000000
--- a/legacy/utils/report/get_results.py
+++ /dev/null
@@ -1,58 +0,0 @@
-##############################################################################
-# Copyright (c) 2017 ZTE Corporation 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 os
-import json
-
-
-def report_concat(targ_dir, testcase):
- machine_temp = []
- machines = []
-
- for file in os.listdir(targ_dir):
- if file.endswith(".json"):
- machine_temp.append(file)
-
- l = len(machine_temp)
-
- for x in range(0, l):
- file_t = machine_temp[x]
- with open(targ_dir + file_t) as result_file:
- result_djson = json.load(result_file)
- if result_djson['1 Testcase Name'] == str(testcase):
- machines.append(result_djson)
- return machines
-
-
-def space_count(l):
- spc = ''
- for x in range(l):
- spc = spc + ' '
- return spc
-
-
-def custom_dict(list1, list2, k):
- string_1 = ''
- for num_1 in range(0, len(list1)):
- string_1 = string_1 + space_count(k) + str(list1[num_1][0]) + "=" + str(list2[num_1]) + "\n"
- return string_1
-
-
-def generate_result(dict_a, k):
- list_1 = []
- list_2 = []
- count = 0
- for i, j in sorted(dict_a.iteritems()):
- list_1.append([])
- list_1[count].append(i)
- if (str(type(dict_a.get(i)))) == "<type 'dict'>":
- list_2.append(str("\n" + generate_result(dict_a.get(i), int(k + 1))))
- else:
- list_2.append(dict_a.get(i))
- count = count + 1
- return custom_dict(list_1, list_2, k)
diff --git a/legacy/utils/report/qtip_graph.py b/legacy/utils/report/qtip_graph.py
deleted file mode 100644
index 68ed660f..00000000
--- a/legacy/utils/report/qtip_graph.py
+++ /dev/null
@@ -1,38 +0,0 @@
-##############################################################################
-# Copyright (c) 2017 ZTE Corporation 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 matplotlib
-import matplotlib.pyplot as plt
-import numpy as np
-
-matplotlib.use('Agg')
-
-
-def plot_indices(a, b, c):
- N = 3
- ind = np.arange(N)
- y_axis = (a, b, c)
- width = 0.35
- f = plt.figure()
- ax = f.gca()
- ax.set_autoscale_on(True)
- my_bars = ax.bar(ind, y_axis, width, color='b')
- ax.set_ylabel('Index Score*')
- ax.set_xlabel('Suite')
- ax.set_title(' QTIP benchmark scores')
- ax.axis('on')
- my_bars = ax.bar(ind, y_axis, width)
- ax.set_xticks(ind + width / 2)
- ax.set_xticklabels(['Compute', 'Storage', 'Network'])
- ax.axis([0, 3, 0, 1.25])
- f.text(0.7, 0.01, '* With Comparison to Refernece POD', fontsize=9)
-
- for rect in my_bars:
- height = rect.get_height()
- ax.text(rect.get_x() + rect.get_width() / 2., 1.05 * height, height, ha='center', va='bottom')
- f.savefig('qtip_graph.jpeg')
diff --git a/legacy/utils/report/qtip_report.py b/legacy/utils/report/qtip_report.py
deleted file mode 100644
index 1097df5f..00000000
--- a/legacy/utils/report/qtip_report.py
+++ /dev/null
@@ -1,117 +0,0 @@
-##############################################################################
-# Copyright (c) 2017 ZTE Corporation 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
-##############################################################################
-from reportlab.platypus import SimpleDocTemplate, Paragraph, Spacer, Image
-from reportlab.lib.styles import getSampleStyleSheet
-from reportlab.lib.units import inch
-from reportlab.lib.pagesizes import letter
-import qtip_graph as graph
-import get_indices as results
-from get_results import report_concat
-from get_results import generate_result
-
-
-def dump_result(Stor, directory, testcase):
- try:
- lower_s = testcase.lower()
- Stor.append(Paragraph(testcase, Style['h3']))
- l1 = report_concat(directory, lower_s)
- l = 1
- for a in l1:
- Stor.append(Paragraph(testcase + " result_" + str(l), Style['h5']))
- raw_string = generate_result(a, 0)
- replaced_string = raw_string.replace('\n', '<br/> ').replace(' ', '&nbsp;')
- Stor.append(Paragraph(replaced_string, Style['BodyText']))
- l = l + 1
- except OSError:
- print "Results for {0} not found".format(testcase)
-
-
-doc = SimpleDocTemplate("../../results/QTIP_results.pdf", pagesize=letter,
- rightMargin=72, leftMargin=72,
- topMargin=72, bottomMargin=18)
-Stor = []
-Style = getSampleStyleSheet()
-Title = "QTIP Benchmark Suite"
-Stor.append(Paragraph(Title, Style['Title']))
-H1 = "Results"
-Stor.append(Spacer(0, 36))
-Stor.append(Paragraph(H1, Style['h2']))
-compute = 0
-storage = 0
-network = 0
-try:
- compute = results.get_index('compute_result')
-except IOError:
- pass
-
-try:
- storage = results.get_index('storage_result')
-except IOError:
- pass
-try:
- network = results.get_index('network_result')
-except IOError:
- pass
-
-Stor.append(Paragraph("Compute Suite: %f" % compute, Style['h5']))
-Stor.append(Paragraph("Storage Suite: %f" % storage, Style['h5']))
-Stor.append(Paragraph("Network Suite: %f" % network, Style['h5']))
-graph.plot_indices(compute, storage, network)
-qtip_graph = ('qtip_graph.jpeg')
-im = Image(qtip_graph, 5 * inch, 4 * inch)
-Stor.append(im)
-Stor.append(Spacer(0, 12))
-Stor.append(Paragraph("Reference POD", Style['h5']))
-ptext = "The Dell OPNFV Lab POD3 has been taken as the reference POD against which the reference results have been collected. The POD consists of 6 identical servers. The details of such a server are:"
-Stor.append(Paragraph(ptext, Style['Normal']))
-ptext = "<bullet>&bull;</bullet>Server Type: Dell PowerEdge R630 Server"
-Stor.append(Paragraph(ptext, Style['Bullet']))
-ptext = "<bullet>&bull;</bullet>CPU: Intel Xeon E5-2698 @ 2300 MHz"
-Stor.append(Paragraph(ptext, Style["Bullet"]))
-ptext = "<bullet>&bull;</bullet>RAM: 128GB"
-Stor.append(Paragraph(ptext, Style["Bullet"]))
-ptext = "<bullet>&bull;</bullet>Storage SSD: 420GB"
-Stor.append(Paragraph(ptext, Style["Bullet"]))
-ptext = "<bullet>&bull;</bullet>Network Card: Intel 2P X520/2P I350 rNDC"
-Stor.append(Paragraph(ptext, Style["Bullet"]))
-ptext = "Servers interconnected through a DELL S4810 switch using a 10Gbps physical link"
-Stor.append(Paragraph(ptext, Style["Bullet"]))
-Stor.append(Spacer(0, 12))
-ptext = "For Further Details of the Reference POD hardware, please visit: https://wiki.opnfv.org/reference_pod_hardware_details"
-Stor.append(Paragraph(ptext, Style['Normal']))
-Stor.append(Spacer(0, 12))
-ptext = "For Details of the Reference POD Results, please visit: https://wiki.opnfv.org/reference_pod_qtip_results"
-Stor.append(Spacer(0, 12))
-Stor.append(Paragraph(ptext, Style['Normal']))
-Stor.append(Paragraph("RAW Results", Style['h1']))
-Stor.append(Paragraph("Compute Results", Style['h2']))
-
-dump_result(Stor, "../../results/dhrystone/", "Dhrystone_bm")
-dump_result(Stor, "../../results/dhrystone/", "Dhrystone_vm")
-
-dump_result(Stor, "../../results/whetstone/", "Whetstone_bm")
-dump_result(Stor, "../../results/whetstone/", "Whetstone_vm")
-
-dump_result(Stor, "../../results/ramspeed/", "Ramspeed_bm")
-dump_result(Stor, "../../results/ramspeed/", "Ramspeed_vm")
-
-dump_result(Stor, "../../results/ssl/", "SSL_bm")
-dump_result(Stor, "../../results/ssl/", "SSL_vm")
-
-Stor.append(Paragraph("Network Results", Style['h2']))
-dump_result(Stor, "../../results/iperf/", "IPERF_bm")
-dump_result(Stor, "../../results/iperf/", "IPERF_vm")
-dump_result(Stor, "../../results/iperf/", "IPERF_vm_2")
-
-Stor.append(Paragraph("Storage Results", Style['h2']))
-dump_result(Stor, "../../results/fio/", "fio_bm")
-dump_result(Stor, "../../results/fio/", "fio_vm")
-
-
-doc.build(Stor)
diff --git a/legacy/utils/spawn_vm.py b/legacy/utils/spawn_vm.py
deleted file mode 100644
index f38c9a3a..00000000
--- a/legacy/utils/spawn_vm.py
+++ /dev/null
@@ -1,206 +0,0 @@
-##############################################################################
-# Copyright (c) 2016 Dell Inc, ZTE 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 os
-import sys
-import yaml
-import heatclient.client
-import keystoneclient
-import time
-from env_setup import Env_setup
-from create_zones import AvailabilityZone
-import logger_utils
-
-logger = logger_utils.QtipLogger('spawn_vm').get
-
-
-class SpawnVM(Env_setup):
-
- def __init__(self, vm_info):
- logger.info('vm_info: %s' % vm_info)
- vm_role_ip_dict = vm_info.copy()
- self._keystone_client = None
- self._heat_client = None
- self._glance_client = None
- self._nova_client = None
- self.azone = AvailabilityZone()
- # TODO: it should clean up aggregates and stack after test case finished.
- self.azone.clean_all_aggregates()
- self.azone.create_aggs(vm_info['availability_zone'])
- self.heat_template = self.generate_heat_template(vm_info)
- self.create_stack(vm_role_ip_dict)
-
- @staticmethod
- def get_public_network():
-
- """
- TODO: GET THE NAMES OF THE PUBLIC NETWORKS for OTHER PROJECTS
- """
- installer = os.environ['INSTALLER_TYPE']
-
- if installer.lower() == 'fuel':
- return 'admin_floating_net'
- if installer.lower() == 'apex':
- return 'external'
- if installer.lower() == 'compass':
- return 'ext-net'
- if installer.lower() == 'joid':
- return 'ext-net'
-
- def generate_heat_template(self, vm_params):
- logger.info('Generating Heat Template')
- heat_dict = {}
- try:
- with open('./config/SampleHeat.yaml', 'r+') as H_temp:
- heat_dict = yaml.safe_load(H_temp)
- except yaml.YAMLError as exc:
- if hasattr(exc, 'problem_mark'):
- mark = exc.problem_mark
- logger.error(
- 'Error in qtip/config/SampleHeat.yaml at: (%s,%s)' % (mark.line + 1,
- mark.column + 1))
- logger.error('EXITING PROGRAM. Correct File and restart')
- sys.exit(1)
-
- fopen = open('./config/QtipKey.pub', 'r')
- fopenstr = fopen.read()
- fopenstr = fopenstr.rstrip()
- scriptcmd = '#!/bin/bash \n echo {0} >> foo.txt \n echo {1} >> /root/.ssh/authorized_keys'.format(
- fopenstr, fopenstr)
-
- netName = self.get_public_network()
- heat_dict['heat_template_version'] = '2015-04-30'
-
- heat_dict['parameters']['public_network'] = {
- 'type': 'string',
- 'default': netName
- }
-
- for x in range(1, len(vm_params['availability_zone']) + 1):
- avail_zone = vm_params['availability_zone'][x - 1]
-
- heat_dict['parameters']['availability_zone_' + str(x)] = \
- {'description': 'Availability Zone of the instance',
- 'default': avail_zone,
- 'type': 'string'}
-
- heat_dict['resources']['public_port_' + str(x)] = \
- {'type': 'OS::Neutron::Port',
- 'properties': {'network': {'get_resource': 'network'},
- 'security_groups': [{'get_resource': 'security_group'}],
- 'fixed_ips': [{'subnet_id': {'get_resource': 'subnet'}}]}}
-
- heat_dict['resources']['floating_ip_' + str(x)] = {
- 'type': 'OS::Neutron::FloatingIP',
- 'properties': {'floating_network': {'get_param': 'external_net_name'}}}
-
- heat_dict['resources']['floating_ip_assoc_' + str(x)] = {
- 'type': 'OS::Neutron::FloatingIPAssociation',
- 'properties': {
- 'floatingip_id': {'get_resource': 'floating_ip_' + str(x)},
- 'port_id': {'get_resource': 'public_port_' + str(x)}}}
-
- heat_dict['resources']['my_instance_' + str(x)] = \
- {'type': 'OS::Nova::Server',
- 'properties': {'image': {'get_param': 'image'},
- 'networks':
- [{'port': {'get_resource': 'public_port_' + str(x)}}],
- 'flavor': {'get_resource': 'flavor'},
- 'availability_zone': avail_zone,
- 'security_groups': [{'get_resource': 'security_group'}],
- 'name': 'instance' + str(x),
- 'user_data_format': 'RAW',
- 'user_data': scriptcmd}}
-
- heat_dict['outputs']['instance_PIP_' + str(x)] = {
- 'description': 'IP address of the instance',
- 'value': {'get_attr': ['my_instance_' + str(x), 'first_address']}}
-
- heat_dict['outputs']['instance_ip_' + str(x)] = {
- 'description': 'IP address of the instance',
- 'value': {'get_attr': ['floating_ip_' + str(x), 'floating_ip_address']}}
-
- heat_dict['outputs']['availability_instance_' + str(x)] = {
- 'description': 'Availability Zone of the Instance',
- 'value': {'get_param': 'availability_zone_' + str(x)}}
-
- del heat_dict['outputs']['description']
- logger.info(heat_dict)
-
- return heat_dict
-
- def _get_keystone_client(self):
- """returns a keystone client instance"""
-
- if self._keystone_client is None:
- self._keystone_client = keystoneclient.v2_0.client.Client(
- auth_url=os.environ.get('OS_AUTH_URL'),
- username=os.environ.get('OS_USERNAME'),
- password=os.environ.get('OS_PASSWORD'),
- tenant_name=os.environ.get('OS_TENANT_NAME'))
- return self._keystone_client
-
- def _get_heat_client(self):
- """returns a heat client instance"""
- if self._heat_client is None:
- keystone = self._get_keystone_client()
- heat_endpoint = keystone.service_catalog.url_for(
- service_type='orchestration')
- self._heat_client = heatclient.client.Client(
- '1', endpoint=heat_endpoint, token=keystone.auth_token)
- return self._heat_client
-
- def create_stack(self, vm_role_ip_dict):
- stackname = 'QTIP'
- heat = self._get_heat_client()
-
- self.delete_stack(stackname)
-
- logger.info('Start to create stack %s' % stackname)
- heat.stacks.create(stack_name=stackname, template=self.heat_template)
-
- stack_status = "IN_PROGRESS"
- while stack_status != 'COMPLETE':
- if stack_status == 'IN_PROGRESS':
- logger.debug('Create in Progress')
- if stack_status == 'CREATE_FAILED':
- raise RuntimeError("Stack %s created failed!" % stackname)
- stack_status = heat.stacks.get(stackname).status
- time.sleep(15)
- logger.info('Stack %s Created Complete!' % stackname)
-
- stack_outputs = heat.stacks.get(stackname).outputs
-
- for vm in range(len(vm_role_ip_dict['OS_image'])):
- for i in stack_outputs:
- instanceKey = "instance_ip_" + str(vm + 1)
- privateIPkey = 'instance_PIP_' + str(vm + 1)
- if i['output_key'] == instanceKey:
- Env_setup.roles_dict[vm_role_ip_dict['role'][vm]] \
- .append(str(i['output_value']))
- Env_setup.ip_pw_list.append((str(i['output_value']), ''))
-
- if i['output_key'] == privateIPkey:
- Env_setup.ip_pw_dict[vm_role_ip_dict['role'][vm]] = str(i['output_value'])
-
- logger.info('Getting Public IP(s): %s' % Env_setup.ip_pw_list)
-
- def delete_stack(self, stack_name):
- heat = self._get_heat_client()
-
- stacks = heat.stacks.list()
- exists = map(lambda x: x.stack_name, stacks)
- if stack_name in exists:
- logger.info("Delete stack %s" % stack_name)
- heat.stacks.delete(stack_name)
- while stack_name in exists:
- time.sleep(10)
- stacks = heat.stacks.list()
- exists = map(lambda x: x.stack_name, stacks)
- logger.debug("exists_stacks: %s" % exists)
- logger.info("%s doesn't exist" % stack_name)
diff --git a/legacy/utils/transform/__init__.py b/legacy/utils/transform/__init__.py
deleted file mode 100644
index e69de29b..00000000
--- a/legacy/utils/transform/__init__.py
+++ /dev/null
diff --git a/legacy/utils/transform/fio_transform.py b/legacy/utils/transform/fio_transform.py
deleted file mode 100644
index e8de2f9a..00000000
--- a/legacy/utils/transform/fio_transform.py
+++ /dev/null
@@ -1,37 +0,0 @@
-##############################################################################
-# Copyright (c) 2017 ZTE Corporation 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 json
-import pickle
-import os
-import datetime
-
-
-def get_fio_job_result(fio_job_data):
- return {'read': {'io_bytes': fio_job_data["read"]["io_bytes"],
- 'io_ps': fio_job_data["read"]["iops"],
- 'io_runtime_millisec': fio_job_data["read"]["runtime"],
- 'mean_io_latenchy_microsec': fio_job_data["read"]["lat"]["mean"]},
- 'write': {'io_bytes': fio_job_data["write"]["io_bytes"],
- 'io_ps': fio_job_data["write"]["iops"],
- 'io_runtime_millisec': fio_job_data["write"]["runtime"],
- 'mean_io_latenchy_microsec': fio_job_data["write"]["lat"]["mean"]}}
-
-
-with open("fio_result.json") as fio_raw:
- fio_data = json.load(fio_raw)
-
-fio_result_dict = {}
-for x, result in enumerate(map(get_fio_job_result, fio_data["jobs"])):
- fio_result_dict['job_{0}'.format(x)] = result
-
-host_name = (os.popen("hostname").read().rstrip())
-report_time = str(datetime.datetime.utcnow().isoformat())
-os.system("mv fio_result.json " + str(host_name) + "-" + report_time + ".log")
-with open('./result_temp', 'w + ')as out_fio_result:
- pickle.dump(fio_result_dict, out_fio_result)
diff --git a/legacy/utils/transform/iperf_transform.py b/legacy/utils/transform/iperf_transform.py
deleted file mode 100644
index c5eef6f5..00000000
--- a/legacy/utils/transform/iperf_transform.py
+++ /dev/null
@@ -1,35 +0,0 @@
-##############################################################################
-# Copyright (c) 2017 ZTE Corporation 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 json
-import datetime
-import pickle
-with open('iperf_raw.json', 'r') as ifile:
- raw_iperf_data = json.loads(ifile.read().rstrip())
-
-bits_sent = raw_iperf_data['end']['sum_sent']['bits_per_second']
-bits_received = raw_iperf_data['end']['sum_received']['bits_per_second']
-total_byte_sent = raw_iperf_data['end']['sum_sent']['bytes']
-total_byte_received = raw_iperf_data['end']['sum_received']['bytes']
-cpu_host_total_percent = raw_iperf_data['end']['cpu_utilization_percent']['host_total']
-cpu_remote_total_percent = raw_iperf_data['end']['cpu_utilization_percent']['remote_total']
-
-time_stamp = str(datetime.datetime.utcnow().isoformat())
-
-result = {'version': raw_iperf_data['start']['version'],
- 'bandwidth': {'sender_throughput': bits_sent,
- 'received_throughput': bits_received},
- 'cpu': {'cpu_host': cpu_host_total_percent,
- 'cpu_remote': cpu_remote_total_percent}
- }
-
-with open('iperf_raw-' + time_stamp + '.log', 'w+') as ofile:
- ofile.write(json.dumps(raw_iperf_data))
-
-with open('./result_temp', 'w+') as result_file:
- pickle.dump(result, result_file)