Migrate cvp-sanity to Python3
* use print function from future
* convert dict keys and values to list
* do not use bunch imports
* fix requirements mismatch
Related: PROD-33849
Change-Id: Ifecc3a9dcdcfe3243f7dcf2c709a80e9a7c765a1
(cherry picked from commit e32e3f9ea37a24da5365dcef2a13609057b61923)
diff --git a/test_set/cvp-sanity/tests/test_mtu.py b/test_set/cvp-sanity/tests/test_mtu.py
index 7af3303..bfe82d5 100644
--- a/test_set/cvp-sanity/tests/test_mtu.py
+++ b/test_set/cvp-sanity/tests/test_mtu.py
@@ -19,7 +19,7 @@
param='ls /sys/class/net/',
expr_form='compound')
- if len(network_info.keys()) < 2:
+ if len(list(network_info.keys())) < 2:
pytest.skip("Nothing to compare - only 1 node")
# collect all nodes and check if virsh is installed there
@@ -30,12 +30,12 @@
expr_form='pillar'
)
- for node, ifaces_info in network_info.iteritems():
+ for node, ifaces_info in network_info.items():
if isinstance(ifaces_info, bool):
logging.info("{} node is skipped".format(node))
continue
# if node is a kvm node and virsh is installed there
- if node in kvm_nodes.keys() and kvm_nodes[node]:
+ if node in list(kvm_nodes.keys()) and kvm_nodes[node]:
kvm_info = local_salt_client.cmd(tgt=node,
param="virsh list | "
"awk '{print $2}' | "
@@ -62,12 +62,12 @@
for node in total:
nodes.append(node)
- my_set.update(total[node].keys())
+ my_set.update(list(total[node].keys()))
for interf in my_set:
diff = []
row = []
for node in nodes:
- if interf in total[node].keys():
+ if interf in list(total[node].keys()):
diff.append(total[node][interf])
row.append("{}: {}".format(node, total[node][interf]))
else: