Added information about MTU at VMs and OS networks
* go inside VMs and get MTUs, print them
* check 'mtu' at neutron nets, print them in table
This information is useful when the QA engineers get
some unexpected results, so they can see which MTU is
set by default at the newly created OS network (SPT
nets) and which MTU is set at VMs (should be the same
as networks have).
Change-Id: Iab7b4bb5830bae0d638b05f9eacc5ae07743eb9d
diff --git a/tests/test_vm2vm.py b/tests/test_vm2vm.py
index 19b6abf..e60a7fd 100644
--- a/tests/test_vm2vm.py
+++ b/tests/test_vm2vm.py
@@ -89,15 +89,22 @@
# Check VMs are reachable and prepare iperf3
transport1 = ssh.SSHTransport(vm_info[0]['fip'], 'ubuntu',
password='dd', private_key=private_key)
- logger.info("Checking VMs are reachable via SSH...")
+ logger.info("Checking VMs are reachable via SSH, getting MTU...")
+ mtus = []
for i in range(4):
if transport1.check_vm_is_reachable_ssh(
floating_ip=vm_info[i]['fip'], timeout=ssh_timeout):
ssh.prepare_iperf(vm_info[i]['fip'], private_key=private_key)
+ mtus.append(transport1.get_mtu_from_vm(
+ vm_info[i]['fip'], private_key=private_key))
+ logger.info("MTU at networks: {}, {}".format(os_resources['net1']['mtu'],
+ os_resources['net2']['mtu']))
+ logger.info("MTU at VMs: {}".format(", ".join(mtus)))
# Prepare the result table and run iperf3
table_rows = []
- table_rows.append(['Test Case', 'Host 1', 'Host 2', 'Result'])
+ table_rows.append(['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...")
@@ -110,6 +117,7 @@
'Private IP, 1 thread',
"{}".format(pair[0]),
"{}".format(pair[0]),
+ "{}, {}".format(mtus[0], mtus[1]),
"{}".format(res1)])
# Do iperf3 measurement #2
@@ -124,6 +132,7 @@
'via Private IP, 1 thread',
"{}".format(pair[0]),
"{}".format(pair[1]),
+ "{}, {}".format(mtus[0], mtus[2]),
"{}".format(res2)])
# Do iperf3 measurement #3
@@ -138,6 +147,7 @@
'via Private IP, 10 threads',
"{}".format(pair[0]),
"{}".format(pair[1]),
+ "{}, {}".format(mtus[0], mtus[2]),
"{}".format(res3)])
# Do iperf3 measurement #4
@@ -152,6 +162,7 @@
'are on different nodes, 1 thread',
"{}".format(pair[0]),
"{}".format(pair[1]),
+ "{}, {}".format(mtus[0], mtus[2]),
"{}".format(res4)])
# Do iperf3 measurement #5
@@ -169,11 +180,12 @@
' connected using Router via Private IP, 1 thread',
"{}".format(pair[0]),
"{}".format(pair[1]),
+ "{}, {}".format(mtus[0], mtus[3]),
"{}".format(res5)])
logger.info("Drawing the table with iperf results...")
result_table.add_rows(table_rows)
- print((result_table.draw()))
+ print('\n{}'.format(result_table.draw()))
print("Removing VMs and FIPs...")
logger.info("Removing VMs and FIPs...")
diff --git a/utils/ssh.py b/utils/ssh.py
index 0d82c52..f6d61a2 100644
--- a/utils/ssh.py
+++ b/utils/ssh.py
@@ -178,6 +178,13 @@
"seconds.".format(floating_ip, attempts, bsleep))
time.sleep(bsleep)
+ def get_mtu_from_vm(self, floating_ip, user='ubuntu', password='password',
+ private_key=None):
+ transport = SSHTransport(floating_ip, user, password, private_key)
+ iface = (transport.exec_command(
+ 'ls /sys/class/net | grep -v lo | head -n 1')).decode("utf-8")
+ mtu = transport.exec_command('cat /sys/class/net/{}/mtu'.format(iface))
+ return mtu.decode("utf-8")
class prepare_iperf(object):