[SPT] Added details of vm2vm measurements to output in table
PROD-32021: The details of vm2vm measurements were missed
and were not printed, just numbers were printer without
description of the test case. Fixed this by drawing the
table.
Change-Id: I12051e5d0cd7542477feb2c6e973a01e7b141b22
Realated: PROD-32021
(cherry picked from commit adb4964cced8434c5823f28fc3423fc3211047d0)
diff --git a/test_set/cvp-spt/tests/test_vm2vm.py b/test_set/cvp-spt/tests/test_vm2vm.py
index fc93347..d3c7178 100644
--- a/test_set/cvp-spt/tests/test_vm2vm.py
+++ b/test_set/cvp-spt/tests/test_vm2vm.py
@@ -1,7 +1,10 @@
import os
import random
import time
+
import pytest
+from texttable import Texttable
+
import utils
from utils import os_client
from utils import ssh
@@ -11,6 +14,7 @@
os_actions = os_client.OSCliActions(openstack_clients)
config = utils.get_configuration()
timeout = int(config.get('nova_timeout', 30))
+ result_table = Texttable()
try:
zone1 = [service.zone for service in openstack_clients.compute.services.list() if service.host == pair[0]]
zone2 = [service.zone for service in openstack_clients.compute.services.list() if service.host == pair[1]]
@@ -70,32 +74,51 @@
vm_info.append({'vm': vms[i], 'fip': fip.ip, 'private_address': private_address})
transport1 = ssh.SSHTransport(vm_info[0]['fip'], 'ubuntu', password='dd', private_key=os_resources['keypair'].private_key)
+ table_rows = []
+ table_rows.append(['Test Case', 'Host 1', 'Host 2', 'Result'])
result1 = transport1.exec_command('iperf -c {} -t 60 | tail -n 1'.format(vm_info[1]['private_address']))
- print(' '.join(result1.split()[-2::]))
+ res1 = ' '.join(result1.split()[-2::])
+ table_rows.append(['VM to VM in same tenant on same node via Private IP, 1 thread',
+ "{}".format(pair[0]),
+ "{}".format(pair[0]),
+ "{}".format(res1)])
- record_property("same {0}-{1}".format(zone1[0],zone2[0]), ' '.join(result1.split()[-2::]))
result2 = transport1.exec_command('iperf -c {} -t 60 | tail -n 1'.format(vm_info[2]['private_address']))
- print(' '.join(result2.split()[-2::]))
+ res2 = ' '.join(result2.split()[-2::])
+ table_rows.append(['VM to VM in same tenant on different HW nodes via Private IP, 1 thread',
+ "{}".format(pair[0]),
+ "{}".format(pair[1]),
+ "{}".format(res2)])
- record_property("diff host {0}-{1}".format(zone1[0],zone2[0]), ' '.join(result2.split()[-2::]))
result3 = transport1.exec_command('iperf -c {} -P 10 -t 60 | tail -n 1'.format(vm_info[2]['private_address']))
- print(' '.join(result3.split()[-2::]))
+ res3 = ' '.join(result3.split()[-2::])
+ table_rows.append(['VM to VM in same tenant on different HW nodes via Private IP, 10 threads',
+ "{}".format(pair[0]),
+ "{}".format(pair[1]),
+ "{}".format(res3)])
- record_property("dif host 10 threads {0}-{1}".format(zone1[0],zone2[0]), ' '.join(result3.split()[-2::]))
result4 = transport1.exec_command('iperf -c {} -t 60 | tail -n 1'.format(vm_info[2]['fip']))
- print(' '.join(result4.split()[-2::]))
+ res4 = ' '.join(result4.split()[-2::])
+ table_rows.append(['VM to VM in same tenant via Floating IP and VMs are on different nodes, 1 thread',
+ "{}".format(pair[0]),
+ "{}".format(pair[1]),
+ "{}".format(res4)])
- record_property("diff host fip {0}-{1}".format(zone1[0],zone2[0]), ' '.join(result4.split()[-2::]))
result5 = transport1.exec_command('iperf -c {} -t 60 | tail -n 1'.format(vm_info[3]['private_address']))
- print(' '.join(result5.split()[-2::]))
+ res5 = ' '.join(result5.split()[-2::])
+ table_rows.append(['VM to VM in same tenant, different HW nodes and each VM is connected to separate network which are connected using Router via Private IP, 1 thread',
+ "{}".format(pair[0]),
+ "{}".format(pair[1]),
+ "{}".format(res5)])
- record_property("diff host, diff net {0}-{1}".format(zone1[0],zone2[0]), ' '.join(result5.split()[-2::]))
+ result_table.add_rows(table_rows)
+ print(result_table.draw())
- print("Remove VMs")
+ print("Removing VMs...")
for vm in vms:
openstack_clients.compute.servers.delete(vm)
- print("Remove FIPs")
+ print("Removing FIPs...")
for fip in fips:
openstack_clients.compute.floating_ips.delete(fip)
except Exception as e: