Added VM2VM test between different routers in 2 projects
Added the test:
VM to VM test in different projects, different networks,
different routers, measure by Floating IPs (common floating net):
* a separate project is created, admin user is added to it
* VMs are in separate projects (admin and newly created),
separate networks, each project has its own router.
VMs have access to each other only by the common floating net.
* VMs are created on the same and different compute nodes.
* Verification is done via Floating IPs in 1 and multiple threads.
Other enhancements:
* renamed "tenant" variables and values to "project"
* more detailed logging (e.g. in which project resource is created)
* some refactoring
* fixed picking existing spt flavor if any
* check the project is empty before deleting it
* added stderr, stdout in case Internet is absent at VM and iperf
was not installed
Related-PROD: PROD-36943
Change-Id: I165ed41259336e586ad16ed9eb27ea59619db4c8
diff --git a/tests/test_vm2vm.py b/tests/test_vm2vm.py
index 0a89f1e..44b584e 100644
--- a/tests/test_vm2vm.py
+++ b/tests/test_vm2vm.py
@@ -118,39 +118,40 @@
'Test Case', 'Host 1', 'Host 2', 'MTU at VMs', 'Result'
]]
# Do iperf3 measurement #1
- logger.info("Doing 'VM to VM in same tenant on same node via Private "
- "IP, 1 thread' measurement...")
+ measurement1 = ("VM to VM in same project on same node via Private "
+ "IP, 1 thread; iperf3")
+ logger.info("Doing '{}' measurement...".format(measurement1))
result1 = transport1.exec_command(
'iperf3 -c {} -t {} | grep sender | tail -n 1'.format(
vm_info[1]['private_address'], iperf_time))
res1 = (b" ".join(result1.split()[-4:-2:])).decode('utf-8')
logger.info("Result #1 is {}".format(res1))
- table_rows.append(['VM to VM in same tenant on same node via '
- 'Private IP, 1 thread; iperf3',
+ table_rows.append([measurement1,
"{}".format(pair[0]),
"{}".format(pair[0]),
"{}, {}".format(mtus[0], mtus[1]),
"{}".format(res1)])
# Do iperf3 measurement #2
- logger.info("Doing 'VM to VM in same tenant on different HW nodes "
- "via Private IP, 1 thread' measurement...")
+ measurement2 = ("VM to VM in same project on different HW nodes via "
+ "Private IP, 1 thread; iperf3")
+ logger.info("Doing '{}' measurement...".format(measurement2))
result2 = transport1.exec_command(
'iperf3 -c {} -t {} | grep sender | tail -n 1'.format(
vm_info[2]['private_address'], iperf_time))
res2 = (b" ".join(result2.split()[-4:-2:])).decode('utf-8')
logger.info("Result #2 is {}".format(res2))
- table_rows.append(['VM to VM in same tenant on different HW nodes '
- 'via Private IP, 1 thread; iperf3',
+ table_rows.append([measurement2,
"{}".format(pair[0]),
"{}".format(pair[1]),
"{}, {}".format(mtus[0], mtus[2]),
"{}".format(res2)])
- # Do iperf3 measurement #3
- logger.info("Doing 'VM to VM in same tenant on different HW nodes "
- "via Private IP, {} threads' measurement..."
- "".format(threads))
+ # Do iperf/iperf3 measurement #3
+ measurement3 = ("VM to VM in same project on different HW nodes via "
+ "Private IP, {} threads; {}"
+ "".format(threads, iperf_utility))
+ logger.info("Doing '{}' measurement...".format(measurement3))
if iperf_utility == "iperf3":
result3 = transport1.exec_command(
'{} -c {} -P {} -t {} | grep sender | tail -n 1'
@@ -161,47 +162,43 @@
iperf_utility = "iperf"
result3 = transport1.exec_command(
'{} -c {} -P {} -t {} | tail -n 1'.format(
- iperf_utility, vm_info[2]['private_address'],
- threads, iperf_time))
+ iperf_utility, vm_info[2]['private_address'], threads,
+ iperf_time))
res3 = (b" ".join(result3.split()[-2::])).decode('utf-8')
logger.info("Result #3 is {}".format(res3))
- table_rows.append(['VM to VM in same tenant on different HW nodes '
- 'via Private IP, {} threads; {}'
- ''.format(threads, iperf_utility),
+ table_rows.append([measurement3,
"{}".format(pair[0]),
"{}".format(pair[1]),
"{}, {}".format(mtus[0], mtus[2]),
"{}".format(res3)])
- # Do iperf (v2) measurement #4
- logger.info("Doing 'VM to VM in same tenant via Floating IP and VMs "
- "are on different nodes, 1 thread' measurement...")
+ # Do iperf3 measurement #4
+ measurement4 = ("VM to VM in same project via Floating IP and VMs "
+ "are on different nodes, 1 thread; iperf3")
+ logger.info("Doing '{}' measurement...".format(measurement4))
result4 = transport1.exec_command(
'iperf3 -c {} -t {} | grep sender | tail -n 1'.format(
vm_info[2]['fip'], iperf_time))
res4 = (b" ".join(result4.split()[-4:-2:])).decode('utf-8')
logger.info("Result #4 is {}".format(res4))
- table_rows.append(['VM to VM in same tenant via Floating IP and VMs '
- 'are on different nodes, 1 thread; iperf3',
+ table_rows.append([measurement4,
"{}".format(pair[0]),
"{}".format(pair[1]),
"{}, {}".format(mtus[0], mtus[2]),
"{}".format(res4)])
# Do iperf3 measurement #5
- logger.info("Doing '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' "
- "measurement...")
+ measurement5 = ("VM to VM in same project, different HW nodes and "
+ "each VM is connected to separate network which are "
+ "connected using Router via Private IP, 1 thread; "
+ "iperf3")
+ logger.info("Doing '{}' measurement...".format(measurement5))
result5 = transport1.exec_command(
'iperf3 -c {} -t {} | grep sender | tail -n 1'.format(
vm_info[3]['private_address'], iperf_time))
res5 = (b" ".join(result5.split()[-4:-2:])).decode('utf-8')
logger.info("Result #5 is {}".format(res5))
- 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; '
- 'iperf3',
+ table_rows.append([measurement5,
"{}".format(pair[0]),
"{}".format(pair[1]),
"{}, {}".format(mtus[0], mtus[3]),