diff --git a/test/integration/component/cpu_limits/__init__.py b/test/integration/component/cpu_limits/__init__.py
index d216be4ddc94..13a83393a912 100644
--- a/test/integration/component/cpu_limits/__init__.py
+++ b/test/integration/component/cpu_limits/__init__.py
@@ -13,4 +13,4 @@
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
-# under the License.
\ No newline at end of file
+# under the License.
diff --git a/test/integration/component/find_hosts_for_migration.py b/test/integration/component/find_hosts_for_migration.py
index 50789b2bf3ba..875d5cf17814 100644
--- a/test/integration/component/find_hosts_for_migration.py
+++ b/test/integration/component/find_hosts_for_migration.py
@@ -19,7 +19,8 @@
"""
#Import Local Modules
from nose.plugins.attrib import attr
-from marvin.cloudstackTestCase import cloudstackTestCase, unittest
+from marvin.cloudstackTestCase import cloudstackTestCase
+import unittest
from marvin.cloudstackAPI import (migrateVirtualMachine,
prepareHostForMaintenance,
cancelHostMaintenance,
@@ -270,4 +271,4 @@ def test_01_find_hosts_for_migration(self):
self.assertTrue(notSuitableHost is not None, "notsuitablehost should not be None")
self.debug("Suitable Hosts: %s" % suitableHost)
- self.debug("Not suitable Hosts: %s" % notSuitableHost)
\ No newline at end of file
+ self.debug("Not suitable Hosts: %s" % notSuitableHost)
diff --git a/test/integration/component/maint/__init__.py b/test/integration/component/maint/__init__.py
index f044f8bcd9a9..2b7631b16121 100644
--- a/test/integration/component/maint/__init__.py
+++ b/test/integration/component/maint/__init__.py
@@ -18,4 +18,4 @@
"""
Tests that put hosts, zones, resources in to maintenance mode are here.
These will have to be run sequentiall when resources are available so as not disrupt other tests
-"""
\ No newline at end of file
+"""
diff --git a/test/integration/component/maint/test_bugs.py b/test/integration/component/maint/test_bugs.py
index ab3f7e797a5c..b839dbe6a6ca 100644
--- a/test/integration/component/maint/test_bugs.py
+++ b/test/integration/component/maint/test_bugs.py
@@ -16,7 +16,8 @@
# under the License.
# Import Local Modules
-from marvin.cloudstackTestCase import cloudstackTestCase, unittest
+from marvin.cloudstackTestCase import cloudstackTestCase
+import unittest
from marvin.cloudstackAPI import (updateStoragePool,
resizeVolume,
listCapacity,
diff --git a/test/integration/component/maint/test_capacity_host_delete.py b/test/integration/component/maint/test_capacity_host_delete.py
index aba5152e35f9..2745adb8a280 100644
--- a/test/integration/component/maint/test_capacity_host_delete.py
+++ b/test/integration/component/maint/test_capacity_host_delete.py
@@ -18,7 +18,8 @@
# Test from the Marvin - Testing in Python wiki
# All tests inherit from cloudstackTestCase
-from marvin.cloudstackTestCase import cloudstackTestCase, unittest
+from marvin.cloudstackTestCase import cloudstackTestCase
+import unittest
# Import Integration Libraries
diff --git a/test/integration/component/maint/test_dedicate_guest_vlan_ranges.py b/test/integration/component/maint/test_dedicate_guest_vlan_ranges.py
index 9a0e7f09ff33..a90082ad1288 100644
--- a/test/integration/component/maint/test_dedicate_guest_vlan_ranges.py
+++ b/test/integration/component/maint/test_dedicate_guest_vlan_ranges.py
@@ -24,7 +24,8 @@
"""
#Import Local Modules
from nose.plugins.attrib import attr
-from marvin.cloudstackTestCase import cloudstackTestCase, unittest
+from marvin.cloudstackTestCase import cloudstackTestCase
+import unittest
from marvin.lib.utils import (validateList,
cleanup_resources,
random_gen,
diff --git a/test/integration/component/maint/test_dedicate_public_ip_range.py b/test/integration/component/maint/test_dedicate_public_ip_range.py
index fe6b5d576167..cde2b789c1d8 100644
--- a/test/integration/component/maint/test_dedicate_public_ip_range.py
+++ b/test/integration/component/maint/test_dedicate_public_ip_range.py
@@ -26,7 +26,8 @@
"""
# Import Local Modules
from nose.plugins.attrib import attr
-from marvin.cloudstackTestCase import cloudstackTestCase, unittest
+from marvin.cloudstackTestCase import cloudstackTestCase
+import unittest
from marvin.lib.utils import (validateList,
cleanup_resources,
random_gen)
diff --git a/test/integration/component/maint/test_escalation_templates.py b/test/integration/component/maint/test_escalation_templates.py
index 61ca0df6fbb4..68012c0b0916 100644
--- a/test/integration/component/maint/test_escalation_templates.py
+++ b/test/integration/component/maint/test_escalation_templates.py
@@ -15,7 +15,8 @@
# specific language governing permissions and limitations
# under the License.
-from marvin.cloudstackTestCase import cloudstackTestCase, unittest
+from marvin.cloudstackTestCase import cloudstackTestCase
+import unittest
from marvin.lib.base import (Account,
Domain, Template, Configurations,VirtualMachine,Snapshot,ServiceOffering
)
@@ -161,7 +162,7 @@ def test_01_CS40139_listtemplate_with_different_pagesize(self):
account=self.account.name,
domainid=self.account.domainid)
status = validateList(listfirst500template)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"First 500 template list is empty")
@@ -173,7 +174,7 @@ def test_01_CS40139_listtemplate_with_different_pagesize(self):
account=self.account.name,
domainid=self.account.domainid)
status = validateList(listremainingtemplate)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"Next 500 template list is empty")
@@ -185,7 +186,7 @@ def test_01_CS40139_listtemplate_with_different_pagesize(self):
account=self.account.name,
domainid=self.account.domainid)
status = validateList(listalltemplate)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"entire template list is empty")
@@ -253,7 +254,7 @@ def test_02_template_permissions(self):
)
self.updateConfigurAndRestart("allow.public.user.templates", "true")
self.fail("Template creation passed for user")
- except CloudstackAPIException as e:
+ except CloudstackAPIException as e:
self.assertRaises("Exception Raised : %s" % e)
# Register new public template as domain admin
# Exception should be raised for registering public template
@@ -268,7 +269,7 @@ def test_02_template_permissions(self):
)
self.updateConfigurAndRestart("allow.public.user.templates", "true")
self.fail("Template creation passed for domain admin")
- except CloudstackAPIException as e:
+ except CloudstackAPIException as e:
self.assertRaises("Exception Raised : %s" % e)
if self.hypervisor.lower() in ['hyperv', 'lxc']:
@@ -314,7 +315,7 @@ def test_02_template_permissions(self):
)
self.updateConfigurAndRestart("allow.public.user.templates", "true")
self.fail("Template creation passed from snapshot for domain user")
- except CloudstackAPIException as e:
+ except CloudstackAPIException as e:
self.assertRaises("Exception Raised : %s" % e)
VirtualMachine.stop(user_vm_created, self.user_api_client)
@@ -324,7 +325,7 @@ def test_02_template_permissions(self):
domainid=user_account.domainid,
state="Stopped")
status = validateList(list_stopped_vms_after)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"Stopped VM is not in Stopped state"
@@ -336,7 +337,7 @@ def test_02_template_permissions(self):
)
self.updateConfigurAndRestart("allow.public.user.templates", "true")
self.fail("Template creation passed from volume for domain user")
- except CloudstackAPIException as e:
+ except CloudstackAPIException as e:
self.assertRaises("Exception Raised : %s" % e)
admin_vm_created = VirtualMachine.create(
@@ -378,7 +379,7 @@ def test_02_template_permissions(self):
)
self.updateConfigurAndRestart("allow.public.user.templates", "true")
self.fail("Template creation passed from snapshot for domain admin")
- except CloudstackAPIException as e:
+ except CloudstackAPIException as e:
self.assertRaises("Exception Raised : %s" % e)
VirtualMachine.stop(admin_vm_created, self.admin_api_client)
@@ -388,7 +389,7 @@ def test_02_template_permissions(self):
domainid=self.account.domainid,
state="Stopped")
status = validateList(list_stopped_vms_after)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"Stopped VM is not in Stopped state"
@@ -400,7 +401,7 @@ def test_02_template_permissions(self):
)
self.updateConfigurAndRestart("allow.public.user.templates", "true")
self.fail("Template creation passed from volume for domain admin")
- except CloudstackAPIException as e:
+ except CloudstackAPIException as e:
self.assertRaises("Exception Raised : %s" % e)
self.updateConfigurAndRestart("allow.public.user.templates", "true")
diff --git a/test/integration/component/maint/test_escalations_hosts.py b/test/integration/component/maint/test_escalations_hosts.py
index bdc10744b3f8..4d07517a2585 100644
--- a/test/integration/component/maint/test_escalations_hosts.py
+++ b/test/integration/component/maint/test_escalations_hosts.py
@@ -18,7 +18,8 @@
# Test from the Marvin - Testing in Python wiki
# All tests inherit from cloudstackTestCase
-from marvin.cloudstackTestCase import cloudstackTestCase, unittest
+from marvin.cloudstackTestCase import cloudstackTestCase
+import unittest
# Import Integration Libraries
diff --git a/test/integration/component/maint/test_high_availability.py b/test/integration/component/maint/test_high_availability.py
index 7d662c7fb2ec..35ba3d7f35df 100644
--- a/test/integration/component/maint/test_high_availability.py
+++ b/test/integration/component/maint/test_high_availability.py
@@ -20,7 +20,8 @@
"""
# Import Local Modules
from nose.plugins.attrib import attr
-from marvin.cloudstackTestCase import cloudstackTestCase, unittest
+from marvin.cloudstackTestCase import cloudstackTestCase
+import unittest
from marvin.cloudstackAPI import (prepareHostForMaintenance,
cancelHostMaintenance)
from marvin.lib.utils import cleanup_resources
diff --git a/test/integration/component/maint/test_host_high_availability.py b/test/integration/component/maint/test_host_high_availability.py
index 8d20a609e153..c95b5db89b67 100644
--- a/test/integration/component/maint/test_host_high_availability.py
+++ b/test/integration/component/maint/test_host_high_availability.py
@@ -19,7 +19,8 @@
"""
#Import Local Modules
from nose.plugins.attrib import attr
-from marvin.cloudstackTestCase import cloudstackTestCase, unittest
+from marvin.cloudstackTestCase import cloudstackTestCase
+import unittest
from marvin.cloudstackAPI import (migrateVirtualMachine,
prepareHostForMaintenance,
cancelHostMaintenance)
diff --git a/test/integration/component/maint/test_ip_resource_count_for_vpc.py b/test/integration/component/maint/test_ip_resource_count_for_vpc.py
index 9f853fa44ebb..3557931ee4c5 100644
--- a/test/integration/component/maint/test_ip_resource_count_for_vpc.py
+++ b/test/integration/component/maint/test_ip_resource_count_for_vpc.py
@@ -19,7 +19,8 @@
"""
#Import Local Modules
from nose.plugins.attrib import attr
-from marvin.cloudstackTestCase import cloudstackTestCase, unittest
+from marvin.cloudstackTestCase import cloudstackTestCase
+import unittest
from marvin.lib.base import (VirtualMachine,
NetworkOffering,
VpcOffering,
diff --git a/test/integration/component/maint/test_multiple_ip_ranges.py b/test/integration/component/maint/test_multiple_ip_ranges.py
index 8e63ec4616ea..36e742479b8b 100644
--- a/test/integration/component/maint/test_multiple_ip_ranges.py
+++ b/test/integration/component/maint/test_multiple_ip_ranges.py
@@ -16,7 +16,8 @@
# under the License.
""" Tests for Multiple IP Ranges feature
"""
-from marvin.cloudstackTestCase import cloudstackTestCase, unittest
+from marvin.cloudstackTestCase import cloudstackTestCase
+import unittest
from marvin.lib.utils import cleanup_resources, get_process_status
from marvin.lib.base import (Account,
DiskOffering,
@@ -203,11 +204,11 @@ def setUp(self):
)
self.ip_range = list(
netaddr.iter_iprange(
- unicode(
- self.testdata["vlan_ip_range"]["startip"]), unicode(
+ str(
+ self.testdata["vlan_ip_range"]["startip"]), str(
self.testdata["vlan_ip_range"]["endip"])))
self.nic_ip = netaddr.IPAddress(
- unicode(
+ str(
self.vm_response[0].nic[0].ipaddress))
self.debug("vm got {} as ip address".format(self.nic_ip))
self.assertIn(
@@ -281,11 +282,11 @@ def test_01_deploy_vm_in_new_cidr(self):
"""
self.ip_range = list(
netaddr.iter_iprange(
- unicode(
- self.testdata["vlan_ip_range"]["startip"]), unicode(
+ str(
+ self.testdata["vlan_ip_range"]["startip"]), str(
self.testdata["vlan_ip_range"]["endip"])))
self.nic_ip = netaddr.IPAddress(
- unicode(
+ str(
self.vm_response[0].nic[0].ipaddress))
self.debug("vm got {} as ip address".format(self.nic_ip))
self.assertIn(
diff --git a/test/integration/component/maint/test_vpc_host_maintenance.py b/test/integration/component/maint/test_vpc_host_maintenance.py
index c5900eb10182..37dc950c1abe 100644
--- a/test/integration/component/maint/test_vpc_host_maintenance.py
+++ b/test/integration/component/maint/test_vpc_host_maintenance.py
@@ -19,7 +19,8 @@
"""
#Import Local Modules
from nose.plugins.attrib import attr
-from marvin.cloudstackTestCase import cloudstackTestCase, unittest
+from marvin.cloudstackTestCase import cloudstackTestCase
+import unittest
from marvin.cloudstackAPI import migrateSystemVm
from marvin.lib.utils import cleanup_resources
from marvin.lib.base import (Host,
diff --git a/test/integration/component/maint/test_vpc_on_host_maintenance.py b/test/integration/component/maint/test_vpc_on_host_maintenance.py
index 3735b6882a03..e1312e9e40f6 100644
--- a/test/integration/component/maint/test_vpc_on_host_maintenance.py
+++ b/test/integration/component/maint/test_vpc_on_host_maintenance.py
@@ -16,7 +16,8 @@
# under the License.
from nose.plugins.attrib import attr
-from marvin.cloudstackTestCase import cloudstackTestCase, unittest
+from marvin.cloudstackTestCase import cloudstackTestCase
+import unittest
from marvin.lib.utils import cleanup_resources
from marvin.lib.base import (Account,
Host,
diff --git a/test/integration/component/maint/testpath_disablestoragepool.py b/test/integration/component/maint/testpath_disablestoragepool.py
index c1bb2040b6f7..795003eec725 100644
--- a/test/integration/component/maint/testpath_disablestoragepool.py
+++ b/test/integration/component/maint/testpath_disablestoragepool.py
@@ -19,7 +19,8 @@
# All tests inherit from cloudstack TestCase
from marvin.cloudstackTestCase import cloudstackTestCase
-from marvin.cloudstackTestCase import cloudstackTestCase, unittest
+from marvin.cloudstackTestCase import cloudstackTestCase
+import unittest
from marvin.codes import FAILED, PASS
from marvin.lib.base import (Account,
VirtualMachine,
diff --git a/test/integration/component/maint/testpath_vMotion_vmware.py b/test/integration/component/maint/testpath_vMotion_vmware.py
index 27c85ffbb154..4768319d1f69 100644
--- a/test/integration/component/maint/testpath_vMotion_vmware.py
+++ b/test/integration/component/maint/testpath_vMotion_vmware.py
@@ -17,7 +17,8 @@
""" Test cases for Test Paths Storage Migration
"""
from nose.plugins.attrib import attr
-from marvin.cloudstackTestCase import cloudstackTestCase, unittest
+from marvin.cloudstackTestCase import cloudstackTestCase
+import unittest
from marvin.lib.utils import (cleanup_resources,
validateList,
is_server_ssh_ready
diff --git a/test/integration/component/test_acquire_specified_public_ip.py b/test/integration/component/test_acquire_specified_public_ip.py
index 01a4470f161d..4482e16ea85a 100644
--- a/test/integration/component/test_acquire_specified_public_ip.py
+++ b/test/integration/component/test_acquire_specified_public_ip.py
@@ -21,7 +21,8 @@
# Import Local Modules
from nose.plugins.attrib import attr
-from marvin.cloudstackTestCase import cloudstackTestCase, unittest
+from marvin.cloudstackTestCase import cloudstackTestCase
+import unittest
from marvin.cloudstackAPI import createVlanIpRange
from marvin.lib.utils import (validateList,
cleanup_resources)
diff --git a/test/integration/component/test_add_remove_network.py b/test/integration/component/test_add_remove_network.py
index 38aeee42dd69..29930b2df019 100644
--- a/test/integration/component/test_add_remove_network.py
+++ b/test/integration/component/test_add_remove_network.py
@@ -27,7 +27,8 @@
# Import Local Modules
from nose.plugins.attrib import attr
-from marvin.cloudstackTestCase import cloudstackTestCase, unittest
+from marvin.cloudstackTestCase import cloudstackTestCase
+import unittest
from ddt import ddt, data
from marvin.lib.base import (
Account,
@@ -1058,7 +1059,7 @@ def test_30_remove_nic_reattach(self):
networkids=[self.isolated_network.id, self.ntwk2.id, self.ntwk3.id]
)
self.assertIsNotNone(self.test_vm, "Failed to create vm with 3 nics")
- map(lambda x: self.cleanup.append(x), [self.test_vm, self.ntwk2, self.ntwk3])
+ list(map(lambda x: self.cleanup.append(x), [self.test_vm, self.ntwk2, self.ntwk3]))
vm_res = VirtualMachine.list(
self.apiclient,
id=self.test_vm.id
diff --git a/test/integration/component/test_advancedsg_networks.py b/test/integration/component/test_advancedsg_networks.py
index 2273e15006ea..6a8851212121 100644
--- a/test/integration/component/test_advancedsg_networks.py
+++ b/test/integration/component/test_advancedsg_networks.py
@@ -17,7 +17,8 @@
""" P1 tests for networks in advanced zone with security groups
"""
-from marvin.cloudstackTestCase import cloudstackTestCase, unittest
+from marvin.cloudstackTestCase import cloudstackTestCase
+import unittest
from ddt import ddt, data
from marvin.lib.base import (Zone,
ServiceOffering,
@@ -2162,7 +2163,7 @@ def test_34_DeployVM_in_SecondSGNetwork(self):
name=self.services["test_34_DeployVM_in_SecondSGNetwork"]["zone"]
)
status = validateList(zone_list)
- self.assertEquals(status[0], PASS, "Failed to list the zones")
+ self.assertEqual(status[0], PASS, "Failed to list the zones")
count = 0
"""
In simulator environment default guest os template should be in ready state immediately after the ssvm is up.
@@ -2260,7 +2261,7 @@ def test_34_DeployVM_in_SecondSGNetwork(self):
)
#construct ip list using start and end ips in the network
for i in range(0,nwIPs):
- ips_in_new_network.append(str(ip_gen.next()))
+ ips_in_new_network.append(str(next(ip_gen)))
if vm_ip not in ips_in_new_network:
self.fail("vm did not get the ip from new SG enabled shared network")
self.cleanup_vms.append(vm_2)
diff --git a/test/integration/component/test_affinity_groups.py b/test/integration/component/test_affinity_groups.py
index be0a6e5cff1c..445364877a7c 100644
--- a/test/integration/component/test_affinity_groups.py
+++ b/test/integration/component/test_affinity_groups.py
@@ -15,7 +15,8 @@
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
-from marvin.cloudstackTestCase import cloudstackTestCase, unittest
+from marvin.cloudstackTestCase import cloudstackTestCase
+import unittest
from marvin.cloudstackAPI import deleteAffinityGroup
from marvin.lib.utils import (cleanup_resources,
random_gen)
@@ -187,8 +188,8 @@ def test_01_admin_create_aff_grp(self):
acc=self.account.name, domainid=self.account.domainid)
self.debug("Created Affinity Group: %s" % aff_grp.name)
list_aff_grps = AffinityGroup.list(self.api_client, id=aff_grp.id)
- self.assert_(isinstance(list_aff_grps, list) and len(list_aff_grps) > 0)
- self.assert_(list_aff_grps[0].id == aff_grp.id)
+ self.assertTrue(isinstance(list_aff_grps, list) and len(list_aff_grps) > 0)
+ self.assertTrue(list_aff_grps[0].id == aff_grp.id)
self.cleanup.append(aff_grp)
@attr(tags=["simulator", "basic", "advanced"], required_hardware="false")
@@ -455,7 +456,7 @@ def test_03_list_aff_grps_by_id(self):
"""
self.create_aff_grp(aff_grp=self.services["host_anti_affinity"])
- print self.aff_grp[0].__dict__
+ print(self.aff_grp[0].__dict__)
list_aff_grps = AffinityGroup.list(self.api_client)
list_aff_grps = AffinityGroup.list(self.api_client, id=list_aff_grps[0].id)
self.assertEqual(list_aff_grps[0].name, self.aff_grp[0].name,
@@ -646,7 +647,7 @@ def create_vm_in_aff_grps(self, ag_list, account_name=None, domain_id=None):
def delete_aff_group(self, apiclient, **kwargs):
cmd = deleteAffinityGroup.deleteAffinityGroupCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
return apiclient.deleteAffinityGroup(cmd)
@attr(tags=["simulator", "basic", "advanced", "multihost"], required_hardware="false")
@@ -658,7 +659,7 @@ def test_01_delete_aff_grp_by_name(self):
aff_0 = self.create_aff_grp(aff_grp=self.services["host_anti_affinity"])
AffinityGroup.list(self.api_client, name=aff_0.name)
self.delete_aff_group(self.api_client, name=aff_0.name)
- self.assert_(AffinityGroup.list(self.api_client, name=aff_0.name) is None)
+ self.assertTrue(AffinityGroup.list(self.api_client, name=aff_0.name) is None)
@attr(tags=["simulator", "basic", "advanced", "multihost"], required_hardware="false")
def test_02_delete_aff_grp_for_acc(self):
@@ -688,7 +689,7 @@ def test_03_delete_aff_grp_with_vms(self):
vm, hostid = self.create_vm_in_aff_grps([aff_0.name, aff_1.name], account_name=self.account.name, domain_id=self.domain.id)
aff_0.delete(self.api_client)
vm_list = list_virtual_machines(self.apiclient, id=vm.id)
- self.assert_(vm_list is not None)
+ self.assertTrue(vm_list is not None)
vm.delete(self.api_client)
#Wait for expunge interval to cleanup VM
wait_for_cleanup(self.apiclient, ["expunge.delay", "expunge.interval"])
diff --git a/test/integration/component/test_affinity_groups_projects.py b/test/integration/component/test_affinity_groups_projects.py
index 4be673a6a7b0..16135e24e967 100644
--- a/test/integration/component/test_affinity_groups_projects.py
+++ b/test/integration/component/test_affinity_groups_projects.py
@@ -15,7 +15,8 @@
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
-from marvin.cloudstackTestCase import cloudstackTestCase, unittest
+from marvin.cloudstackTestCase import cloudstackTestCase
+import unittest
from marvin.cloudstackAPI import deleteAffinityGroup
from marvin.lib.utils import (cleanup_resources,
random_gen)
@@ -218,9 +219,9 @@ def test_01_admin_create_aff_grp_for_project(self):
aff_grp = self.create_aff_grp()
self.debug("Created Affinity Group: %s" % aff_grp.name)
list_aff_grps = AffinityGroup.list(self.api_client, id=aff_grp.id)
- self.assert_(isinstance(list_aff_grps, list) and len(list_aff_grps) > 0)
- self.assert_(list_aff_grps[0].id == aff_grp.id)
- self.assert_(list_aff_grps[0].projectid == self.project.id)
+ self.assertTrue(isinstance(list_aff_grps, list) and len(list_aff_grps) > 0)
+ self.assertTrue(list_aff_grps[0].id == aff_grp.id)
+ self.assertTrue(list_aff_grps[0].projectid == self.project.id)
self.cleanup.append(aff_grp)
@attr(tags=["simulator", "basic", "advanced"], required_hardware="false")
@@ -231,9 +232,9 @@ def test_02_doadmin_create_aff_grp_for_project(self):
"""
aff_grp = self.create_aff_grp(api_client=self.domain_api_client)
list_aff_grps = AffinityGroup.list(self.domain_api_client, id=aff_grp.id)
- self.assert_(isinstance(list_aff_grps, list) and len(list_aff_grps) > 0)
- self.assert_(list_aff_grps[0].id == aff_grp.id)
- self.assert_(list_aff_grps[0].projectid == self.project.id)
+ self.assertTrue(isinstance(list_aff_grps, list) and len(list_aff_grps) > 0)
+ self.assertTrue(list_aff_grps[0].id == aff_grp.id)
+ self.assertTrue(list_aff_grps[0].projectid == self.project.id)
self.cleanup.append(aff_grp)
@attr(tags=["vogxn", "simulator", "basic", "advanced"], required_hardware="false")
@@ -244,9 +245,9 @@ def test_03_user_create_aff_grp_for_project(self):
"""
aff_grp = self.create_aff_grp(api_client=self.account_api_client)
list_aff_grps = AffinityGroup.list(self.api_client, id=aff_grp.id)
- self.assert_(isinstance(list_aff_grps, list) and len(list_aff_grps) > 0)
- self.assert_(list_aff_grps[0].id == aff_grp.id)
- self.assert_(list_aff_grps[0].projectid == self.project.id)
+ self.assertTrue(isinstance(list_aff_grps, list) and len(list_aff_grps) > 0)
+ self.assertTrue(list_aff_grps[0].id == aff_grp.id)
+ self.assertTrue(list_aff_grps[0].projectid == self.project.id)
self.cleanup.append(aff_grp)
@attr(tags=["simulator", "basic", "advanced"], required_hardware="false")
@@ -670,7 +671,7 @@ def create_vm_in_aff_grps(self, api_client=None, ag_list=[], projectid=None):
def delete_aff_group(self, apiclient, **kwargs):
cmd = deleteAffinityGroup.deleteAffinityGroupCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
return apiclient.deleteAffinityGroup(cmd)
diff --git a/test/integration/component/test_base_image_updation.py b/test/integration/component/test_base_image_updation.py
index e38aa336eee0..133db821267a 100644
--- a/test/integration/component/test_base_image_updation.py
+++ b/test/integration/component/test_base_image_updation.py
@@ -28,7 +28,8 @@
from marvin.codes import (PASS,
RECURRING)
from nose.plugins.attrib import attr
-from marvin.cloudstackTestCase import cloudstackTestCase, unittest
+from marvin.cloudstackTestCase import cloudstackTestCase
+import unittest
from marvin.lib.base import (ServiceOffering,
Account,
@@ -419,7 +420,7 @@ def test_03_restore_vm_with_new_template(self):
hypervisor = host_list_validation_result[1].hypervisor
- for k, v in self.services["templates"].items():
+ for k, v in list(self.services["templates"].items()):
if k.lower() == hypervisor.lower():
# Register new template
template = Template.register(
diff --git a/test/integration/component/test_blocker_bugs.py b/test/integration/component/test_blocker_bugs.py
index dce6781d0647..cffb488e3ba3 100644
--- a/test/integration/component/test_blocker_bugs.py
+++ b/test/integration/component/test_blocker_bugs.py
@@ -36,7 +36,8 @@
get_builtin_template_info)
#Import Local Modules
-from marvin.cloudstackTestCase import cloudstackTestCase, unittest
+from marvin.cloudstackTestCase import cloudstackTestCase
+import unittest
from marvin.cloudstackAPI import restartNetwork
from marvin.codes import PASS
import time
diff --git a/test/integration/component/test_brocade_vcs.py b/test/integration/component/test_brocade_vcs.py
index adaf21bda5ec..1b2dcebe66ee 100644
--- a/test/integration/component/test_brocade_vcs.py
+++ b/test/integration/component/test_brocade_vcs.py
@@ -19,7 +19,8 @@
"""
#Import Local Modules
from nose.plugins.attrib import attr
-from marvin.cloudstackTestCase import cloudstackTestCase, unittest
+from marvin.cloudstackTestCase import cloudstackTestCase
+import unittest
from marvin.cloudstackAPI import (listPhysicalNetworks,
listNetworkServiceProviders,
addNetworkServiceProvider,
diff --git a/test/integration/component/test_browse_templates.py b/test/integration/component/test_browse_templates.py
index 4340092b9a06..3bceb44fc731 100644
--- a/test/integration/component/test_browse_templates.py
+++ b/test/integration/component/test_browse_templates.py
@@ -20,7 +20,8 @@
import marvin
from nose.plugins.attrib import attr
-from marvin.cloudstackTestCase import cloudstackTestCase, unittest
+from marvin.cloudstackTestCase import cloudstackTestCase
+import unittest
from marvin.cloudstackAPI import *
from marvin.lib.utils import *
from marvin.lib.base import *
@@ -160,7 +161,7 @@ def __verify_values(self, expected_vals, actual_vals):
if len(expected_vals) != len(actual_vals):
return False
- keys = expected_vals.keys()
+ keys = list(expected_vals.keys())
for i in range(0, len(expected_vals)):
exp_val = expected_vals[keys[i]]
act_val = actual_vals[keys[i]]
@@ -284,7 +285,7 @@ def browse_upload_template(self):
results = requests.post(posturl,files=files,headers=headers,verify=False)
- print results.status_code
+ print(results.status_code)
if results.status_code !=200:
self.fail("Upload is not fine")
@@ -377,7 +378,7 @@ def browse_upload_template_with_projectid(self,projectid):
results = requests.post(posturl,files=files,headers=headers,verify=False)
- print results.status_code
+ print(results.status_code)
if results.status_code !=200:
self.fail("Upload is not fine")
@@ -427,7 +428,7 @@ def browse_upload_template_multiplezones(self,lzones):
results = requests.post(posturl,files=files,headers=headers,verify=False)
- print results.status_code
+ print(results.status_code)
if results.status_code !=200:
self.fail("Upload is not fine")
@@ -477,7 +478,7 @@ def uploadtemplate(self):
results = requests.post(posturl,files=files,headers=headers,verify=False)
time.sleep(60)
- print results.status_code
+ print(results.status_code)
if results.status_code !=200:
self.fail("Upload is not fine")
@@ -545,7 +546,7 @@ def attach_volume(self,vmlist,volid):
self.apiclient,
id=volid
)
- print list_volume_response[0]
+ print(list_volume_response[0])
vmlist.attach_volume(
self.apiclient,
list_volume_response[0]
@@ -612,7 +613,7 @@ def detach_volume(self,vmdetails,volid):
self.apiclient,
id=volid
)
- print list_volume_response[0]
+ print(list_volume_response[0])
vmdetails.detach_volume(self.apiclient,list_volume_response[0])
# Sleep to ensure the current state will reflected in other calls
diff --git a/test/integration/component/test_browse_templates2.py b/test/integration/component/test_browse_templates2.py
index 927dd3456105..0aa7bee18a6d 100644
--- a/test/integration/component/test_browse_templates2.py
+++ b/test/integration/component/test_browse_templates2.py
@@ -19,7 +19,8 @@
import marvin
from nose.plugins.attrib import attr
-from marvin.cloudstackTestCase import cloudstackTestCase, unittest
+from marvin.cloudstackTestCase import cloudstackTestCase
+import unittest
from marvin.cloudstackAPI import *
from marvin.lib.utils import *
from marvin.lib.base import *
@@ -32,7 +33,7 @@
import string
import telnetlib
import os
-import urllib
+import urllib.request, urllib.parse, urllib.error
import time
import tempfile
_multiprocess_shared_ = True
diff --git a/test/integration/component/test_browse_volumes.py b/test/integration/component/test_browse_volumes.py
index 08a41b4588a0..09ed681ed403 100644
--- a/test/integration/component/test_browse_volumes.py
+++ b/test/integration/component/test_browse_volumes.py
@@ -20,7 +20,8 @@
import marvin
from nose.plugins.attrib import attr
-from marvin.cloudstackTestCase import cloudstackTestCase, unittest
+from marvin.cloudstackTestCase import cloudstackTestCase
+import unittest
from marvin.cloudstackAPI import *
from marvin.lib.utils import *
from marvin.lib.base import *
@@ -39,7 +40,7 @@
import telnetlib
import os
-import urllib
+import urllib.request, urllib.parse, urllib.error
import time
import tempfile
_multiprocess_shared_ = True
@@ -136,7 +137,7 @@ def __verify_values(self, expected_vals, actual_vals):
if len(expected_vals) != len(actual_vals):
return False
- keys = expected_vals.keys()
+ keys = list(expected_vals.keys())
for i in range(0, len(expected_vals)):
exp_val = expected_vals[keys[i]]
act_val = actual_vals[keys[i]]
@@ -213,7 +214,7 @@ def browse_upload_volume_with_projectid(self,projectid):
results = requests.post(posturl,files=files,headers=headers,verify=False)
- print results.status_code
+ print(results.status_code)
if results.status_code !=200:
self.fail("Upload is not fine")
@@ -299,7 +300,7 @@ def browse_upload_volume(self):
results = requests.post(posturl,files=files,headers=headers,verify=False)
- print results.status_code
+ print(results.status_code)
if results.status_code !=200:
self.fail("Upload is not fine")
@@ -425,7 +426,7 @@ def reuse_url(self):
results = requests.post(posturl,files=files,headers=headers,verify=False)
time.sleep(60)
- print results.status_code
+ print(results.status_code)
if results.status_code == 200:
self.fail("Upload URL is allowed to reuse")
@@ -547,7 +548,7 @@ def browse_upload_volume_with_md5(self):
results = requests.post(posturl,files=files,headers=headers,verify=False)
time.sleep(60)
- print results.status_code
+ print(results.status_code)
if results.status_code !=200:
self.fail("Upload is not fine")
@@ -593,7 +594,7 @@ def browse_upload_volume_with_invalid_md5(self):
results = requests.post(posturl,files=files,headers=headers,verify=False)
time.sleep(60)
- print results.status_code
+ print(results.status_code)
if results.status_code !=200:
self.fail("Upload is not fine")
@@ -647,7 +648,7 @@ def attach_volume(self,vmlist,volid):
self.apiclient,
id=volid
)
- print list_volume_response[0]
+ print(list_volume_response[0])
vmlist.attach_volume(
self.apiclient,
list_volume_response[0]
@@ -715,7 +716,7 @@ def detach_volume(self,vmdetails,volid):
self.apiclient,
id=volid
)
- print list_volume_response[0]
+ print(list_volume_response[0])
vmdetails.detach_volume(self.apiclient,list_volume_response[0])
# Sleep to ensure the current state will reflected in other calls
@@ -821,9 +822,9 @@ def download_volume(self,volumeid):
extract_vol = self.apiclient.extractVolume(cmd)
try:
- formatted_url = urllib.unquote_plus(extract_vol.url)
+ formatted_url = urllib.parse.unquote_plus(extract_vol.url)
self.debug("Attempting to download volume at url %s" % formatted_url)
- response = urllib.urlopen(formatted_url)
+ response = urllib.request.urlopen(formatted_url)
self.debug("response from volume url %s" % response.getcode())
fd, path = tempfile.mkstemp()
self.debug("Saving volume %s to path %s" %(volumeid, path))
@@ -1185,7 +1186,7 @@ def volume_snapshot_template(self,snapshot_created):
self.apiclient,
templatefilter='self')
- self.assertEquals(
+ self.assertEqual(
templates_before_size + 1,
len(list_templates_after),
"Template creation failed from snapshot"
@@ -1763,7 +1764,7 @@ def uploadwithcustomoffering(self):
results = requests.post(posturl,files=files,headers=headers,verify=False)
- print results.status_code
+ print(results.status_code)
if results.status_code !=200:
self.fail("Upload is not fine")
@@ -1808,7 +1809,7 @@ def uploadwithimagestoreid(self):
results = requests.post(posturl,files=files,headers=headers,verify=False)
- print results.status_code
+ print(results.status_code)
if results.status_code !=200:
self.fail("Upload is not fine")
@@ -1916,7 +1917,7 @@ def uploadwithextendedfileextentions(self):
results = requests.post(posturl,files=files,headers=headers,verify=False)
- print results.status_code
+ print(results.status_code)
if results.status_code !=200:
self.fail("Upload is not fine")
@@ -1955,7 +1956,7 @@ def posturlwithdeletedvolume(self,getuploadparamsresponce):
results = requests.post(posturl,files=files,headers=headers,verify=False)
- print results.status_code
+ print(results.status_code)
if results.status_code ==200:
return("FAIL")
return("PASS")
diff --git a/test/integration/component/test_concurrent_snapshots_limit.py b/test/integration/component/test_concurrent_snapshots_limit.py
index fce1dd4439a6..d154e8b2a5f7 100644
--- a/test/integration/component/test_concurrent_snapshots_limit.py
+++ b/test/integration/component/test_concurrent_snapshots_limit.py
@@ -309,4 +309,4 @@ def test_03_concurrent_snapshot_global_value_assignment(self):
"concurrent.snapshots.threshold.perhost",
"String"
)
- return
\ No newline at end of file
+ return
diff --git a/test/integration/component/test_cpu_domain_limits.py b/test/integration/component/test_cpu_domain_limits.py
index 4d7c165bfcc5..82192c103a89 100644
--- a/test/integration/component/test_cpu_domain_limits.py
+++ b/test/integration/component/test_cpu_domain_limits.py
@@ -191,7 +191,7 @@ def test_01_multiple_core_vm_start_stop_instance(self):
users = {self.domain: self.admin,
self.child_domain: self.child_do_admin
}
- for domain, admin in users.items():
+ for domain, admin in list(users.items()):
self.account = admin
self.domain = domain
@@ -267,7 +267,7 @@ def test_02_multiple_core_vm_migrate_instance(self):
users = {self.domain: self.admin,
self.child_domain: self.child_do_admin
}
- for domain, admin in users.items():
+ for domain, admin in list(users.items()):
self.account = admin
self.domain = domain
@@ -328,7 +328,7 @@ def test_03_multiple_core_vm_delete_instance(self):
users = {self.domain: self.admin,
self.child_domain: self.child_do_admin
}
- for domain, admin in users.items():
+ for domain, admin in list(users.items()):
self.account = admin
self.domain = domain
@@ -392,7 +392,7 @@ def test_04_deploy_multiple_vm_with_multiple_core(self):
users = {self.domain: self.admin,
self.child_domain: self.child_do_admin
}
- for domain, admin in users.items():
+ for domain, admin in list(users.items()):
self.account = admin
self.domain = domain
diff --git a/test/integration/component/test_cpu_limits.py b/test/integration/component/test_cpu_limits.py
index b9df64907b46..15a31f8a2c78 100644
--- a/test/integration/component/test_cpu_limits.py
+++ b/test/integration/component/test_cpu_limits.py
@@ -435,7 +435,7 @@ def test_01_stop_start_instance(self):
users = {self.child_domain_1: self.child_do_admin_1,
self.child_domain_2: self.child_do_admin_2
}
- for domain, admin in users.items():
+ for domain, admin in list(users.items()):
self.account = admin
self.domain = domain
@@ -510,7 +510,7 @@ def test_02_migrate_instance(self):
users = {self.child_domain_1: self.child_do_admin_1,
self.child_domain_2: self.child_do_admin_2
}
- for domain, admin in users.items():
+ for domain, admin in list(users.items()):
self.account = admin
self.domain = domain
@@ -570,7 +570,7 @@ def test_03_delete_instance(self):
users = {self.child_domain_1: self.child_do_admin_1,
self.child_domain_2: self.child_do_admin_2
}
- for domain, admin in users.items():
+ for domain, admin in list(users.items()):
self.account = admin
self.domain = domain
@@ -633,7 +633,7 @@ def test_04_deploy_multiple_vm_with_multiple_cpus(self):
users = {self.child_domain_1: self.child_do_admin_1,
self.child_domain_2: self.child_do_admin_2
}
- for domain, admin in users.items():
+ for domain, admin in list(users.items()):
self.account = admin
self.domain = domain
diff --git a/test/integration/component/test_cpu_project_limits.py b/test/integration/component/test_cpu_project_limits.py
index 8a43b7680bd4..5781e6af077e 100644
--- a/test/integration/component/test_cpu_project_limits.py
+++ b/test/integration/component/test_cpu_project_limits.py
@@ -19,7 +19,8 @@
"""
# Import Local Modules
from nose.plugins.attrib import attr
-from marvin.cloudstackTestCase import cloudstackTestCase, unittest
+from marvin.cloudstackTestCase import cloudstackTestCase
+import unittest
from marvin.lib.base import (
Account,
ServiceOffering,
diff --git a/test/integration/component/test_custom_hostname.py b/test/integration/component/test_custom_hostname.py
index ac85b8c37f99..7d71c581e95f 100644
--- a/test/integration/component/test_custom_hostname.py
+++ b/test/integration/component/test_custom_hostname.py
@@ -19,7 +19,8 @@
# Import Local Modules
from nose.plugins.attrib import attr
-from marvin.cloudstackTestCase import cloudstackTestCase, unittest
+from marvin.cloudstackTestCase import cloudstackTestCase
+import unittest
from marvin.lib.utils import (cleanup_resources,
random_gen,
get_hypervisor_type)
diff --git a/test/integration/component/test_deploy_vgpu_vm.py b/test/integration/component/test_deploy_vgpu_vm.py
index de47c42256cf..2c1f124e8efa 100644
--- a/test/integration/component/test_deploy_vgpu_vm.py
+++ b/test/integration/component/test_deploy_vgpu_vm.py
@@ -18,7 +18,8 @@
# Test from the Marvin - Testing in Python wiki
# All tests inherit from cloudstackTestCase
-from marvin.cloudstackTestCase import cloudstackTestCase, unittest
+from marvin.cloudstackTestCase import cloudstackTestCase
+import unittest
from marvin.cloudstackAPI import changeServiceForVirtualMachine, startVirtualMachine
# Import Integration Libraries
diff --git a/test/integration/component/test_deploy_vm_userdata_multi_nic.py b/test/integration/component/test_deploy_vm_userdata_multi_nic.py
index 86c0f1317bff..b82c07967bf4 100644
--- a/test/integration/component/test_deploy_vm_userdata_multi_nic.py
+++ b/test/integration/component/test_deploy_vm_userdata_multi_nic.py
@@ -166,10 +166,10 @@ def test_deployvm_multinic(self):
domainid=self.account.domainid,
id=deployVmResponse.id
)
- self.assert_(len(vms) > 0, "There are no Vms deployed in the account %s" % self.account.name)
+ self.assertTrue(len(vms) > 0, "There are no Vms deployed in the account %s" % self.account.name)
vm = vms[0]
- self.assert_(vm.id == str(deployVmResponse.id), "Vm deployed is different from the test")
- self.assert_(vm.state == "Running", "VM is not in Running state")
+ self.assertTrue(vm.id == str(deployVmResponse.id), "Vm deployed is different from the test")
+ self.assertTrue(vm.state == "Running", "VM is not in Running state")
try:
updateresponse = deployVmResponse.update(self.apiclient, userdata=self.userdata)
diff --git a/test/integration/component/test_deploy_vm_userdata_reg.py b/test/integration/component/test_deploy_vm_userdata_reg.py
index ee1f81a5771d..fb95335da8e3 100644
--- a/test/integration/component/test_deploy_vm_userdata_reg.py
+++ b/test/integration/component/test_deploy_vm_userdata_reg.py
@@ -132,10 +132,10 @@ def test_deployvm_userdata_post(self):
domainid=self.account.domainid,
id=deployVmResponse.id
)
- self.assert_(len(vms) > 0, "There are no Vms deployed in the account %s" % self.account.name)
+ self.assertTrue(len(vms) > 0, "There are no Vms deployed in the account %s" % self.account.name)
vm = vms[0]
- self.assert_(vm.id == str(deployVmResponse.id), "Vm deployed is different from the test")
- self.assert_(vm.state == "Running", "VM is not in Running state")
+ self.assertTrue(vm.id == str(deployVmResponse.id), "Vm deployed is different from the test")
+ self.assertTrue(vm.state == "Running", "VM is not in Running state")
ip_addr=deployVmResponse.ipaddress
if self.zone.networktype == "Basic":
list_router_response = list_routers(
diff --git a/test/integration/component/test_dhcp_dns_offload.py b/test/integration/component/test_dhcp_dns_offload.py
index eea5c26ff16a..d012bcb1763c 100644
--- a/test/integration/component/test_dhcp_dns_offload.py
+++ b/test/integration/component/test_dhcp_dns_offload.py
@@ -16,7 +16,8 @@
# under the License.
""" Tests for DHCP DNS offload feature
"""
-from marvin.cloudstackTestCase import cloudstackTestCase, unittest
+from marvin.cloudstackTestCase import cloudstackTestCase
+import unittest
from marvin.lib.utils import (random_gen, validateList, cleanup_resources, get_hypervisor_type)
from marvin.lib.base import (Account,
NIC,
@@ -321,7 +322,7 @@ def verifyMetaData(self, metadata):
self.assertEqual(validateList(qresultset)[0], PASS, "sql query returned invalid response")
self.assertEqual(
metadata["vm-id.txt"][0],
- unicode(qresultset[0][0]),
+ str(qresultset[0][0]),
"vm id in metadata does not match with the vm id from cloud db"
)
return
diff --git a/test/integration/component/test_dynamic_compute_offering.py b/test/integration/component/test_dynamic_compute_offering.py
index 1889fbfbea54..1f8740c9c422 100644
--- a/test/integration/component/test_dynamic_compute_offering.py
+++ b/test/integration/component/test_dynamic_compute_offering.py
@@ -25,7 +25,8 @@
Feature Specifications: https://cwiki.apache.org/confluence/display/
CLOUDSTACK/Dynamic+Compute+Offering+FS
"""
-from marvin.cloudstackTestCase import cloudstackTestCase, unittest
+from marvin.cloudstackTestCase import cloudstackTestCase
+import unittest
from marvin.lib.utils import (cleanup_resources,
validateList,
random_gen,
diff --git a/test/integration/component/test_egress_fw_rules.py b/test/integration/component/test_egress_fw_rules.py
index f3bce20afd42..fc64cc6a3df3 100644
--- a/test/integration/component/test_egress_fw_rules.py
+++ b/test/integration/component/test_egress_fw_rules.py
@@ -19,7 +19,8 @@
"""
#Import Local Modules
from nose.plugins.attrib import attr
-from marvin.cloudstackTestCase import cloudstackTestCase, unittest
+from marvin.cloudstackTestCase import cloudstackTestCase
+import unittest
from marvin.lib.base import (Account,
Domain,
Router,
diff --git a/test/integration/component/test_eip_elb.py b/test/integration/component/test_eip_elb.py
index 76987b942547..e0b54317b769 100644
--- a/test/integration/component/test_eip_elb.py
+++ b/test/integration/component/test_eip_elb.py
@@ -19,7 +19,8 @@
"""
# Import Local Modules
from nose.plugins.attrib import attr
-from marvin.cloudstackTestCase import cloudstackTestCase, unittest
+from marvin.cloudstackTestCase import cloudstackTestCase
+import unittest
from marvin.cloudstackAPI import (authorizeSecurityGroupIngress,
disassociateIpAddress,
deleteLoadBalancerRule)
@@ -167,7 +168,7 @@ def setUpClass(cls):
)
if isinstance(ip_addrs, list):
cls.source_nat = ip_addrs[0]
- print "source_nat ipaddress : ", cls.source_nat.ipaddress
+ print("source_nat ipaddress : ", cls.source_nat.ipaddress)
else:
raise Exception(
"No Source NAT IP found for guest network: %s" %
diff --git a/test/integration/component/test_escalation_listTemplateDomainAdmin.py b/test/integration/component/test_escalation_listTemplateDomainAdmin.py
index f0c492989bed..2148a607357f 100644
--- a/test/integration/component/test_escalation_listTemplateDomainAdmin.py
+++ b/test/integration/component/test_escalation_listTemplateDomainAdmin.py
@@ -164,4 +164,4 @@ def download(self, apiclient, template_id, retries=12, interval=5):
else:
retries = retries - 1
- raise Exception("Template download failed exception.")
\ No newline at end of file
+ raise Exception("Template download failed exception.")
diff --git a/test/integration/component/test_escalations_instances.py b/test/integration/component/test_escalations_instances.py
index 9e0d27eb590f..20f398c77bbb 100644
--- a/test/integration/component/test_escalations_instances.py
+++ b/test/integration/component/test_escalations_instances.py
@@ -16,7 +16,8 @@
# under the License.
# Import Local Modules
-from marvin.cloudstackTestCase import cloudstackTestCase, unittest
+from marvin.cloudstackTestCase import cloudstackTestCase
+import unittest
from marvin.lib.utils import cleanup_resources, validateList
from marvin.lib.base import (Account,
ServiceOffering,
@@ -152,7 +153,7 @@ def __verify_values(self, expected_vals, actual_vals):
if len(expected_vals) != len(actual_vals):
return False
- keys = expected_vals.keys()
+ keys = list(expected_vals.keys())
for i in range(0, len(expected_vals)):
exp_val = expected_vals[keys[i]]
act_val = actual_vals[keys[i]]
@@ -222,7 +223,7 @@ def test_01_list_instances_pagination(self):
self.userapiclient,
listall=self.services["listall"])
status = validateList(list_instances_after)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"Listing of instances after creation failed"
@@ -243,7 +244,7 @@ def test_01_list_instances_pagination(self):
domainid=self.account.domainid
)
status = validateList(list_instances_page1)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"Listing of instances in page1 failed"
@@ -264,7 +265,7 @@ def test_01_list_instances_pagination(self):
domainid=self.account.domainid
)
status = validateList(list_instances_page2)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"Listing of instances in page2 failed"
@@ -281,7 +282,7 @@ def test_01_list_instances_pagination(self):
# Verifying that the VM on page 2 is not present in page1
for i in range(0, len(list_instances_page1)):
instance_page1 = list_instances_page1[i]
- self.assertNotEquals(
+ self.assertNotEqual(
instance_page2.id,
instance_page1.id,
"VM listed in page 2 is also listed in page 1"
@@ -354,13 +355,13 @@ def test_02_list_Running_vm(self):
state="Running"
)
status = validateList(list_running_vms_after)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"Newly created VM is not in Running state"
)
# Verifying list size is 1
- self.assertEquals(
+ self.assertEqual(
1,
len(list_running_vms_after),
"Running VM list count is not matching"
@@ -448,13 +449,13 @@ def test_03_list_Stopped_vm(self):
state="Stopped"
)
status = validateList(list_stopped_vms_after)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"Stopped VM is not in Stopped state"
)
# Verifying list size is 1
- self.assertEquals(
+ self.assertEqual(
1,
len(list_stopped_vms_after),
"Stopped VM list count is not matching"
@@ -557,13 +558,13 @@ def test_04_list_Destroyed_vm(self):
id=vm_created.id
)
status = validateList(list_destroyed_vms_admin)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"Destroyed VM is not in Destroyed state"
)
# Verifying that the length of the destroyed VMs list should be 1
- self.assertEquals(
+ self.assertEqual(
1,
len(list_destroyed_vms_admin),
"Destroyed VM list count is not matching"
@@ -648,12 +649,12 @@ def test_05_list_vm_by_id(self):
account=self.account.name
)
status = validateList(list_vms_after)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"Listing of VM after creation failed"
)
- self.assertEquals(
+ self.assertEqual(
1,
len(list_vms_after),
"VM list count is not matching"
@@ -665,7 +666,7 @@ def test_05_list_vm_by_id(self):
id=vm_created.id
)
status = validateList(list_vm_byid)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"Listing of VM by Id failed"
@@ -756,12 +757,12 @@ def test_06_list_vm_by_name(self):
domainid=self.account.domainid,
)
status = validateList(list_vms_after)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"VM's creation failed"
)
- self.assertEquals(
+ self.assertEqual(
2,
len(list_vms_after),
"VM's list count is not matching"
@@ -776,13 +777,13 @@ def test_06_list_vm_by_name(self):
name=vms[0].name
)
status = validateList(list_vm_byfullname)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"Failed to list VM by Name"
)
# Verifying that the size of the list is 1
- self.assertEquals(
+ self.assertEqual(
1,
len(list_vm_byfullname),
"VM list by full name count is not matching"
@@ -825,13 +826,13 @@ def test_06_list_vm_by_name(self):
name=vms[0].name[:1]
)
status = validateList(list_vm_bypartialname)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"Failed to list VM by Name"
)
# Verifying that the size of the list is 2
- self.assertEquals(
+ self.assertEqual(
2,
len(list_vm_bypartialname),
"VM list by full name count is not matching"
@@ -893,12 +894,12 @@ def test_07_list_vm_by_name_state(self):
domainid=self.account.domainid,
)
status = validateList(list_vms_after)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"VM's creation failed"
)
- self.assertEquals(
+ self.assertEqual(
1,
len(list_vms_after),
"VM's list count is not matching"
@@ -914,13 +915,13 @@ def test_07_list_vm_by_name_state(self):
state="Running"
)
status = validateList(list_running_vm)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"List VM by name and state failed"
)
# Verifying that the size of the list is 1
- self.assertEquals(
+ self.assertEqual(
1,
len(list_running_vm),
"Count of VM list by name and state is not matching"
@@ -1008,7 +1009,7 @@ def test_08_list_vm_by_zone(self):
# Listing all the zones available
zones_list = Zone.list(self.apiClient)
status = validateList(zones_list)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"zones not available in the given setup"
@@ -1066,13 +1067,13 @@ def test_08_list_vm_by_zone(self):
zoneid=zones_list[0].id
)
status = validateList(list_vms_after)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"VM creation failed"
)
# Verifying that the size of the list is 1
- self.assertEquals(
+ self.assertEqual(
1,
len(list_vms_after),
"VM list count is not matching"
@@ -1155,7 +1156,7 @@ def test_09_list_vm_by_zone_name(self):
# Listing all the zones available
zones_list = Zone.list(self.apiClient)
status = validateList(zones_list)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"zones not available in the given setup"
@@ -1215,13 +1216,13 @@ def test_09_list_vm_by_zone_name(self):
account=self.account.name
)
status = validateList(list_vms_after)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"VM creation failed"
)
# Verifying that the size of the list is 1
- self.assertEquals(
+ self.assertEqual(
1,
len(list_vms_after),
"VM list count is not matching"
@@ -1238,13 +1239,13 @@ def test_09_list_vm_by_zone_name(self):
name=vm_created.name
)
status = validateList(list_vms)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"Listing VM's by name and zone failed"
)
# Verifying Verifying that the size of the list is 1
- self.assertEquals(
+ self.assertEqual(
1,
len(list_vms),
"Count of listed VM's by name and zone is not as expected"
@@ -1374,13 +1375,13 @@ def test_10_list_vm_by_zone_name_state(self):
account=self.account.name
)
status = validateList(list_vms_after)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"VM creation failed"
)
# Verifying that the size of the list is 1
- self.assertEquals(
+ self.assertEqual(
1,
len(list_vms_after),
"VM list count is not matching"
@@ -1398,13 +1399,13 @@ def test_10_list_vm_by_zone_name_state(self):
state="Running"
)
status = validateList(list_vms)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"Listing VM's by name and zone failed"
)
# Verifying Verifying that the size of the list is 1
- self.assertEquals(
+ self.assertEqual(
1,
len(list_vms),
"Count of listed VM's by name, zone and state is not as expected"
@@ -1468,13 +1469,13 @@ def test_10_list_vm_by_zone_name_state(self):
account=self.account.name
)
status = validateList(list_vms)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"Listing VM's by name, account and zone failed"
)
# Verifying Verifying that the size of the list is 1
- self.assertEquals(
+ self.assertEqual(
1,
len(list_vms),
"Count of listed VM's by name, zone and account is not as expected"
@@ -1553,13 +1554,13 @@ def test_11_register_reset_vm_sshkey(self):
listall=self.services["listall"],
)
status = validateList(list_vms_after)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"VM creation failed"
)
# Verifying that the size of the list is 1
- self.assertEquals(
+ self.assertEqual(
1,
len(list_vms_after),
"VM list count is not matching"
@@ -1586,7 +1587,7 @@ def test_11_register_reset_vm_sshkey(self):
new_keypair,
"New Key pair generation failed"
)
- self.assertEquals(
+ self.assertEqual(
"keypair1",
new_keypair.name,
"Key Pair not created with given name"
@@ -1596,13 +1597,13 @@ def test_11_register_reset_vm_sshkey(self):
self.userapiclient
)
status = validateList(list_keypairs_after)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"Listing of Key pairs failed"
)
# Verifying that list size is increased by 1
- self.assertEquals(
+ self.assertEqual(
list_keypairs_before_size + 1,
len(list_keypairs_after),
"List count is not matching"
@@ -1618,18 +1619,18 @@ def test_11_register_reset_vm_sshkey(self):
id=vm_created.id
)
status = validateList(list_vm)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"Listing of VM failed"
)
- self.assertEquals(
+ self.assertEqual(
1,
len(list_vm),
"VMs list is not as expected"
)
# Verifying that VM's SSH keypair is set to newly created keypair
- self.assertEquals(
+ self.assertEqual(
new_keypair.name,
list_vm[0].keypair,
"VM is not set to newly created SSH Key pair"
@@ -1677,7 +1678,7 @@ def test_12_running_vm_change_service(self):
id=vm_created.serviceofferingid
)
status = validateList(vm_so_list)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"Listing of VM Service offering failed"
@@ -1689,13 +1690,13 @@ def test_12_running_vm_change_service(self):
listall=self.services["listall"],
)
status = validateList(list_vms_after)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"VM creation failed"
)
# Verifying that the size of the list is 1
- self.assertEquals(
+ self.assertEqual(
1,
len(list_vms_after),
"VM list count is not matching"
@@ -1737,18 +1738,18 @@ def test_12_running_vm_change_service(self):
id=vm_created.id
)
status = validateList(list_vms_after)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"Listing of VM failed"
)
- self.assertEquals(
+ self.assertEqual(
1,
len(list_vms_after),
"VMs list is not as expected"
)
# Verifying that VM's service offerings is not changed
- self.assertEquals(
+ self.assertEqual(
current_so.id,
list_vms_after[0].serviceofferingid,
"VM is not containing old Service Offering"
@@ -1818,13 +1819,13 @@ def test_13_vm_nics(self):
listall=self.services["listall"],
)
status = validateList(list_vms_after)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"VM creation failed"
)
# Verifying that the size of the list is 1
- self.assertEquals(
+ self.assertEqual(
1,
len(list_vms_after),
"VM list count is not matching"
@@ -1839,13 +1840,13 @@ def test_13_vm_nics(self):
type="Isolated"
)
status = validateList(list_network_before)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"Default Network not created when deploying a VM"
)
# Verifying that only 1 network is created while deploying a VM
- self.assertEquals(
+ self.assertEqual(
1,
len(list_network_before),
"More than 1 default network exists"
@@ -1886,13 +1887,13 @@ def test_13_vm_nics(self):
type="Isolated"
)
status = validateList(list_network_after)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"List of Networks failed"
)
# Verifying that list size is 2
- self.assertEquals(
+ self.assertEqual(
2,
len(list_network_after),
"More than 1 default network exists"
@@ -1903,13 +1904,13 @@ def test_13_vm_nics(self):
vm_nics_before,
"Nic not found for the VM deployed"
)
- self.assertEquals(
+ self.assertEqual(
1,
len(vm_nics_before),
"VM Nic count is not matching"
)
# Verifying that the nic is same as the default network listed above
- self.assertEquals(
+ self.assertEqual(
network1.id,
vm_nics_before[0].networkid,
"Default NIC for VM is not as expected"
@@ -1926,7 +1927,7 @@ def test_13_vm_nics(self):
id=vm_created.id
)
status = validateList(list_vms_after)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"Listing of VM failed"
@@ -1938,7 +1939,7 @@ def test_13_vm_nics(self):
vm_nics_after,
"Nic not found for the deployed VM"
)
- self.assertEquals(
+ self.assertEqual(
2,
len(vm_nics_after),
"VM NIC's count is not matching"
@@ -1951,14 +1952,14 @@ def test_13_vm_nics(self):
default_nic = vm_nics_after[i]
else:
non_default_nic = vm_nics_after[i]
- self.assertEquals(
+ self.assertEqual(
1,
default_count,
"Default NIC count is not matching"
)
# Verifying that default NIC is same the network created when VM is
# deployed
- self.assertEquals(
+ self.assertEqual(
network1.id,
default_nic.networkid,
"Default NIC is not matching for VM"
@@ -1974,7 +1975,7 @@ def test_13_vm_nics(self):
id=vm_created.id
)
status = validateList(list_vms_after)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"Listing of VM failed"
@@ -1986,7 +1987,7 @@ def test_13_vm_nics(self):
vm_nics_after,
"Nic not found for the deployed VM"
)
- self.assertEquals(
+ self.assertEqual(
2,
len(vm_nics_after),
"VM NIC's count is not matching"
@@ -2000,14 +2001,14 @@ def test_13_vm_nics(self):
else:
non_default_nic = vm_nics_after[i]
- self.assertEquals(
+ self.assertEqual(
1,
default_count,
"Default NIC count is not matching"
)
# Verifying that default NIC is same the newly updated network (network
# 2)
- self.assertEquals(
+ self.assertEqual(
network2.id,
default_nic.networkid,
"Default NIC is not matching for VM"
@@ -2044,7 +2045,7 @@ def test_13_vm_nics(self):
id=vm_created.id
)
status = validateList(list_vms_after)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"Listing of VM failed"
@@ -2056,13 +2057,13 @@ def test_13_vm_nics(self):
vm_nics_after,
"Nic not found for the deployed VM"
)
- self.assertEquals(
+ self.assertEqual(
1,
len(vm_nics_after),
"VM NIC's count is not matching"
)
# Verifying the nic network is same as the default nic network
- self.assertEquals(
+ self.assertEqual(
network2.id,
vm_nics_after[0].networkid,
"VM NIC is not same as expected"
@@ -2092,7 +2093,7 @@ def test_14_Create_vm_with_same_sshkey(self):
new_keypair1,
"New Key pair generation failed"
)
- self.assertEquals(
+ self.assertEqual(
"keypair1",
new_keypair1.name,
"Key Pair not created with given name"
@@ -2102,13 +2103,13 @@ def test_14_Create_vm_with_same_sshkey(self):
self.userapiclient
)
status = validateList(list_keypairs_after)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"Listing of Key pairs failed"
)
# Verifying that list size is increased by 1
- self.assertEquals(
+ self.assertEqual(
list_keypairs_before_size + 1,
len(list_keypairs_after),
"List count is not matching"
@@ -2133,7 +2134,7 @@ def test_14_Create_vm_with_same_sshkey(self):
listall=True,
)
status = validateList(list_vms_after)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"VM creation failed"
@@ -2153,7 +2154,7 @@ def test_14_Create_vm_with_same_sshkey(self):
name="keypair2",
publickey="ssh-rsa: e6:9a:1e:b5:98:75:88:5d:56:bc:92:7b:43:48:05:b2")
self.fail("SSH Key creation passed using same public key ")
- except CloudstackAPIException as e:
+ except CloudstackAPIException as e:
self.assertRaises("Exception Raised : %s" % e)
return
@@ -2269,7 +2270,7 @@ def __verify_values(self, expected_vals, actual_vals):
if len(expected_vals) != len(actual_vals):
return False
- keys = expected_vals.keys()
+ keys = list(expected_vals.keys())
for i in range(0, len(expected_vals)):
exp_val = expected_vals[keys[i]]
act_val = actual_vals[keys[i]]
@@ -2332,7 +2333,7 @@ def test_27_VM_restore_ES3467(self):
timeout -= 1
# Verify template response to check whether template added successfully
status = validateList(list_template_response)
- self.assertEquals(PASS, status[0], "Template download failed")
+ self.assertEqual(PASS, status[0], "Template download failed")
self.assertNotEqual(
len(list_template_response),
@@ -2682,13 +2683,13 @@ def test_13_attach_detach_iso(self):
account=self.account.name
)
status = validateList(list_vms_after)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"VM creation failed"
)
# Verifying that the size of the list is 1
- self.assertEquals(
+ self.assertEqual(
1,
len(list_vms_after),
"VM list count is not matching"
@@ -2728,18 +2729,18 @@ def test_13_attach_detach_iso(self):
id=vm_created.id
)
status = validateList(list_vm)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"VM listing by Id failed"
)
# Verifying that attached ISO details are present in VM
- self.assertEquals(
+ self.assertEqual(
iso_toattach.name,
list_vm[0].isoname,
"Attached ISO name is not matching"
)
- self.assertEquals(
+ self.assertEqual(
iso_toattach.displaytext,
list_vm[0].isodisplaytext,
"Attached ISO display is not matching"
@@ -2754,7 +2755,7 @@ def test_13_attach_detach_iso(self):
id=vm_created.id
)
status = validateList(list_vm)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"VM listing by Id failed"
@@ -2816,13 +2817,13 @@ def test_14_vm_snapshot_pagination(self):
listall=self.services["listall"],
)
status = validateList(list_vms_after)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"VM creation failed"
)
# Verifying that the size of the list is 1
- self.assertEquals(
+ self.assertEqual(
1,
len(list_vms_after),
"VM list count is not matching"
@@ -2856,12 +2857,12 @@ def test_14_vm_snapshot_pagination(self):
virtualmachineid=vm_created.id
)
status = validateList(list_snapshots_after)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"VM Snapshots creation failed"
)
- self.assertEquals(
+ self.assertEqual(
self.services["pagesize"] + 1,
len(list_snapshots_after),
"Count of VM Snapshots is not matching"
@@ -2875,13 +2876,13 @@ def test_14_vm_snapshot_pagination(self):
pagesize=self.services["pagesize"],
)
status = validateList(list_snapshots_page1)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"Listing of VM Snapshots failed in page 1"
)
# Verifying the list size is equal to pagesize
- self.assertEquals(
+ self.assertEqual(
self.services["pagesize"],
len(list_snapshots_page1),
"List VM Snapshot count is not matching in page 1"
@@ -2895,13 +2896,13 @@ def test_14_vm_snapshot_pagination(self):
pagesize=self.services["pagesize"],
)
status = validateList(list_snapshots_page2)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"Listing of VM Snapshots failed in page 2"
)
# Verifying the list size is equal to 1
- self.assertEquals(
+ self.assertEqual(
1,
len(list_snapshots_page2),
"List VM Snapshot count is not matching in page 2"
@@ -2978,13 +2979,13 @@ def test_15_revert_vm_to_snapshot(self):
listall=self.services["listall"],
)
status = validateList(list_vms_after)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"VM creation failed"
)
# Verifying that the size of the list is 1
- self.assertEquals(
+ self.assertEqual(
1,
len(list_vms_after),
"VM list count is not matching"
@@ -3026,12 +3027,12 @@ def test_15_revert_vm_to_snapshot(self):
virtualmachineid=vm_created.id
)
status = validateList(list_snapshots_after)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"VM Snapshots creation failed"
)
- self.assertEquals(
+ self.assertEqual(
2,
len(list_snapshots_after),
"Count of VM Snapshots is not matching"
@@ -3044,12 +3045,12 @@ def test_15_revert_vm_to_snapshot(self):
current_count = current_count + 1
current_snapshot = list_snapshots_after[i]
- self.assertEquals(
+ self.assertEqual(
1,
current_count,
"count of VM Snapshot with current flag as true is not matching"
)
- self.assertEquals(
+ self.assertEqual(
snapshot2.id,
current_snapshot.id,
"Latest snapshot taken is not marked as current"
@@ -3067,12 +3068,12 @@ def test_15_revert_vm_to_snapshot(self):
virtualmachineid=vm_created.id
)
status = validateList(list_snapshots_after)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"VM Snapshots creation failed"
)
- self.assertEquals(
+ self.assertEqual(
2,
len(list_snapshots_after),
"Count of VM Snapshots is not matching"
@@ -3084,12 +3085,12 @@ def test_15_revert_vm_to_snapshot(self):
if (list_snapshots_after[i].current is True):
current_count = current_count + 1
current_snapshot = list_snapshots_after[i]
- self.assertEquals(
+ self.assertEqual(
1,
current_count,
"count of VM Snapshot with current flag as true is not matching"
)
- self.assertEquals(
+ self.assertEqual(
snapshot1.id,
current_snapshot.id,
"Current flag was set properly after reverting the VM to snapshot"
@@ -3148,13 +3149,13 @@ def test_16_list_vm_volumes_pagination(self):
listall=self.services["listall"],
)
status = validateList(list_vms_after)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"VM creation failed"
)
# Verifying that the size of the list is 1
- self.assertEquals(
+ self.assertEqual(
1,
len(list_vms_after),
"VM list count is not matching"
@@ -3166,13 +3167,13 @@ def test_16_list_vm_volumes_pagination(self):
virtualmachineid=vm_created.id
)
status = validateList(list_volumes_before)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"Root volume is not created for VM deployed"
)
# Verifying the size of the list is 1
- self.assertEquals(
+ self.assertEqual(
1,
len(list_volumes_before),
"Volumes count is not matching"
@@ -3202,13 +3203,13 @@ def test_16_list_vm_volumes_pagination(self):
virtualmachineid=vm_created.id
)
status = validateList(list_volumes_after)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"Volumes are not listed"
)
# Verifying that size of the list is equal to page size + 1
- self.assertEquals(
+ self.assertEqual(
self.services["pagesize"] + 1,
len(list_volumes_after),
"VM's volume count is not matching"
@@ -3222,13 +3223,13 @@ def test_16_list_vm_volumes_pagination(self):
pagesize=self.services["pagesize"]
)
status = validateList(list_volumes_page1)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"Volumes not listed in page1"
)
# Verifying that list size is equal to page size
- self.assertEquals(
+ self.assertEqual(
self.services["pagesize"],
len(list_volumes_page1),
"VM's volume count is not matching in page 1"
@@ -3242,13 +3243,13 @@ def test_16_list_vm_volumes_pagination(self):
pagesize=self.services["pagesize"]
)
status = validateList(list_volumes_page2)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"Volumes not listed in page2"
)
# Verifying that list size is equal to 1
- self.assertEquals(
+ self.assertEqual(
1,
len(list_volumes_page2),
"VM's volume count is not matching in page 1"
@@ -3280,13 +3281,13 @@ def test_16_list_vm_volumes_pagination(self):
pagesize=self.services["pagesize"]
)
status = validateList(list_volumes_page1)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"Volumes not listed in page1"
)
# Verifying that list size is equal to page size
- self.assertEquals(
+ self.assertEqual(
self.services["pagesize"],
len(list_volumes_page1),
"VM's volume count is not matching in page 1"
@@ -3350,7 +3351,7 @@ def test_17_running_vm_scaleup(self):
name="enable.dynamic.scale.vm"
)
status = validateList(list_config)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"Listing of configuration failed"
@@ -3390,7 +3391,7 @@ def test_17_running_vm_scaleup(self):
id=vm_created.serviceofferingid
)
status = validateList(vm_so_list)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"Listing of VM Service offering failed"
@@ -3402,13 +3403,13 @@ def test_17_running_vm_scaleup(self):
listall=self.services["listall"],
)
status = validateList(list_vms_after)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"VM creation failed"
)
# Verifying that the size of the list is 1
- self.assertEquals(
+ self.assertEqual(
1,
len(list_vms_after),
"VM list count is not matching"
@@ -3460,18 +3461,18 @@ def test_17_running_vm_scaleup(self):
id=vm_created.id
)
status = validateList(list_vms_after)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"Listing of VM failed"
)
- self.assertEquals(
+ self.assertEqual(
1,
len(list_vms_after),
"VMs list is not as expected"
)
# Verifying that VM's service offerings is changed
- self.assertEquals(
+ self.assertEqual(
new_so.id,
list_vms_after[0].serviceofferingid,
"VM is not containing New Service Offering"
@@ -3520,7 +3521,7 @@ def test_18_stopped_vm_change_service(self):
id=vm_created.serviceofferingid
)
status = validateList(vm_so_list)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"Listing of VM Service offering failed"
@@ -3532,13 +3533,13 @@ def test_18_stopped_vm_change_service(self):
listall=self.services["listall"],
)
status = validateList(list_vms_after)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"VM creation failed"
)
# Verifying that the size of the list is 1
- self.assertEquals(
+ self.assertEqual(
1,
len(list_vms_after),
"VM list count is not matching"
@@ -3584,18 +3585,18 @@ def test_18_stopped_vm_change_service(self):
id=vm_created.id
)
status = validateList(list_vm)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"Listing of VM failed"
)
- self.assertEquals(
+ self.assertEqual(
1,
len(list_vm),
"VMs list is not as expected"
)
# Verifying that VM's service offerings is changed
- self.assertEquals(
+ self.assertEqual(
new_so.id,
list_vm[0].serviceofferingid,
"VM is not containing New Service Offering"
@@ -3643,13 +3644,13 @@ def test_19_create_reset_vm_sshkey(self):
listall=self.services["listall"],
)
status = validateList(list_vms_after)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"VM creation failed"
)
# Verifying that the size of the list is 1
- self.assertEquals(
+ self.assertEqual(
1,
len(list_vms_after),
"VM list count is not matching"
@@ -3678,7 +3679,7 @@ def test_19_create_reset_vm_sshkey(self):
new_keypair,
"New Key pair generation failed"
)
- self.assertEquals(
+ self.assertEqual(
"keypair1",
new_keypair.name,
"Key Pair not created with given name"
@@ -3688,13 +3689,13 @@ def test_19_create_reset_vm_sshkey(self):
self.userapiclient
)
status = validateList(list_keypairs_after)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"Listing of Key pairs failed"
)
# Verifying that list size is increased by 1
- self.assertEquals(
+ self.assertEqual(
list_keypairs_before_size + 1,
len(list_keypairs_after),
"List count is not matching"
@@ -3710,18 +3711,18 @@ def test_19_create_reset_vm_sshkey(self):
id=vm_created.id
)
status = validateList(list_vm)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"Listing of VM failed"
)
- self.assertEquals(
+ self.assertEqual(
1,
len(list_vm),
"VMs list is not as expected"
)
# Verifying that VM's SSH keypair is set to newly created keypair
- self.assertEquals(
+ self.assertEqual(
new_keypair.name,
list_vm[0].keypair,
"VM is not set to newly created SSH Key pair"
@@ -3765,12 +3766,12 @@ def test_20_update_vm_displayname_group(self):
"VM creation failed"
)
# Verifying the displayname and group details for deployed VM
- self.assertEquals(
+ self.assertEqual(
self.services["virtual_machine"]["displayname"],
vm_created.displayname,
"Display name of VM is not as expected"
)
- self.assertEquals(
+ self.assertEqual(
"groupName",
vm_created.group,
"Group of VM is not as expected"
@@ -3781,13 +3782,13 @@ def test_20_update_vm_displayname_group(self):
listall=self.services["listall"],
)
status = validateList(list_vms_after)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"VM creation failed"
)
# Verifying that the size of the list is 1
- self.assertEquals(
+ self.assertEqual(
1,
len(list_vms_after),
"VM list count is not matching"
@@ -3805,23 +3806,23 @@ def test_20_update_vm_displayname_group(self):
id=vm_created.id,
)
status = validateList(list_vm)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"Listing of VM by Id failed"
)
- self.assertEquals(
+ self.assertEqual(
1,
len(list_vm),
"Count of List VM by Id is not matching"
)
# Verifying that displayname and group details are updated
- self.assertEquals(
+ self.assertEqual(
"DisplayName",
list_vm[0].displayname,
"Displayname of VM is not updated"
)
- self.assertEquals(
+ self.assertEqual(
"Group",
list_vm[0].group,
"Group of VM is not updated"
@@ -3868,13 +3869,13 @@ def test_21_restore_vm(self):
listall=self.services["listall"],
)
status = validateList(list_vms_after)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"VM creation failed"
)
# Verifying that the size of the list is 1
- self.assertEquals(
+ self.assertEqual(
1,
len(list_vms_after),
"VM list count is not matching"
@@ -3950,7 +3951,7 @@ def test_22_deploy_vm_multiple_networks(self):
zoneid=self.zone.id
)
status = validateList(network_offerings_list)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"Isolated Network Offerings with sourceNat enabled are not found"
@@ -3978,7 +3979,7 @@ def test_22_deploy_vm_multiple_networks(self):
type="Isolated"
)
status = validateList(network_offerings_list)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"Listing networks failed"
@@ -4014,13 +4015,13 @@ def test_22_deploy_vm_multiple_networks(self):
listall=self.services["listall"],
)
status = validateList(list_vms_after)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"VM creation failed"
)
# Verifying that the size of the list is 1
- self.assertEquals(
+ self.assertEqual(
1,
len(list_vms_after),
"VM list count is not matching"
@@ -4028,7 +4029,7 @@ def test_22_deploy_vm_multiple_networks(self):
# Verifying that the NIC's in VM created are same as provided
vm_nics = vm_created.nic
# Verifying that the size of nics is 2
- self.assertEquals(
+ self.assertEqual(
2,
len(vm_nics),
"NIC's count in VM created is not matching"
@@ -4036,13 +4037,13 @@ def test_22_deploy_vm_multiple_networks(self):
# Verifying that NIC network ID's are as expected
for i in range(0, len(vm_nics)):
if vm_nics[i].isdefault is True:
- self.assertEquals(
+ self.assertEqual(
networks_list_after[0].id,
vm_nics[i].networkid,
"Default NIC is not as expected"
)
else:
- self.assertEquals(
+ self.assertEqual(
networks_list_after[1].id,
vm_nics[i].networkid,
"Non Default NIC is not as expected"
@@ -4095,7 +4096,7 @@ def test_23_deploy_vm_multiple_securitygroups(self):
domainid=self.domain.id
)
status = validateList(security_groups_list)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"Listing Security Groups failed"
@@ -4132,13 +4133,13 @@ def test_23_deploy_vm_multiple_securitygroups(self):
listall=self.services["listall"],
)
status = validateList(list_vms_after)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"VM creation failed"
)
# Verifying that the size of the list is 1
- self.assertEquals(
+ self.assertEqual(
1,
len(list_vms_after),
"VM list count is not matching"
@@ -4147,7 +4148,7 @@ def test_23_deploy_vm_multiple_securitygroups(self):
# provided
vm_securitygroups = vm_created.securitygroup
# Verifying that the size of security groups is 2
- self.assertEquals(
+ self.assertEqual(
2,
len(vm_securitygroups),
"Security Groups count in VM created is not matching"
@@ -4160,7 +4161,7 @@ def test_23_deploy_vm_multiple_securitygroups(self):
vm_securitygroups_flag = False
break
- self.assertEquals(
+ self.assertEqual(
True,
vm_securitygroups_flag,
"Security Groups in VM are not same as created"
@@ -4187,7 +4188,7 @@ def test_24_deploy_vm_with_static_ip_ES1662(self):
zoneid=self.zone.id
)
status = validateList(network_offerings_list)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"Isolated Network Offerings with sourceNat enabled are not found"
@@ -4235,13 +4236,13 @@ def test_24_deploy_vm_with_static_ip_ES1662(self):
id=vm_created.id,
)
status = validateList(vm_response)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"vm list returned invalid response"
)
# Verifying that the size of the list is 1
- self.assertEquals(
+ self.assertEqual(
1,
len(vm_response),
"VM list count is not matching"
@@ -4249,13 +4250,13 @@ def test_24_deploy_vm_with_static_ip_ES1662(self):
# Verifying that the NIC's in VM created are same as provided
vm_nics = vm_created.nic
status = validateList(vm_nics)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"vm list returned invalid response for vm nics"
)
# Verifying that the size of nics is 1
- self.assertEquals(
+ self.assertEqual(
1,
len(vm_nics),
"VM is created with more than one nic which is not expected"
@@ -4263,7 +4264,7 @@ def test_24_deploy_vm_with_static_ip_ES1662(self):
"""
Verifying that NIC IP address is as expected
"""
- self.assertEquals(
+ self.assertEqual(
str(vm_nics[0].ipaddress),
vm_ip,
"VM is not created with static ip address used in vm deployment"
@@ -4305,7 +4306,7 @@ def test_25_ip_reallocation_ES1377(self):
zoneid=self.zone.id
)
status = validateList(network_offerings_list)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"Isolated Network Offerings with sourceNat enabled are not found"
@@ -4357,13 +4358,13 @@ def test_25_ip_reallocation_ES1377(self):
id=vm1.id,
)
status = validateList(vm_response)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"vm list api returned invalid response for vm1"
)
# Verifying that the size of the list is 1
- self.assertEquals(
+ self.assertEqual(
1,
len(vm_response),
"VM list count is not matching"
@@ -4391,13 +4392,13 @@ def test_25_ip_reallocation_ES1377(self):
id=vm2.id,
)
status = validateList(vm_response)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"vm list api returned invalid response for vm2"
)
# Verifying that the size of the list is 1
- self.assertEquals(
+ self.assertEqual(
1,
len(vm_response),
"VM list count is not matching after vm2 deployment"
@@ -4434,13 +4435,13 @@ def test_25_ip_reallocation_ES1377(self):
id=vm3.id,
)
status = validateList(vm_response)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"vm list api returned invalid response for vm3"
)
# Verifying that the size of the list is 1
- self.assertEquals(
+ self.assertEqual(
1,
len(vm_response),
"VM list count is not matching after vm2 deployment"
@@ -4472,13 +4473,13 @@ def test_25_ip_reallocation_ES1377(self):
id=vm4.id,
)
status = validateList(vm_response)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"vm list api returned invalid response for vm4"
)
# Verifying that the size of the list is 1
- self.assertEquals(
+ self.assertEqual(
1,
len(vm_response),
"VM list count is not matching after vm2 deployment"
diff --git a/test/integration/component/test_escalations_ipaddresses.py b/test/integration/component/test_escalations_ipaddresses.py
index 4a971f03a1bc..059843ad5047 100644
--- a/test/integration/component/test_escalations_ipaddresses.py
+++ b/test/integration/component/test_escalations_ipaddresses.py
@@ -16,7 +16,8 @@
# under the License.
# Import Local Modules
-from marvin.cloudstackTestCase import cloudstackTestCase, unittest
+from marvin.cloudstackTestCase import cloudstackTestCase
+import unittest
from marvin.lib.base import (PublicIPAddress,
NetworkOffering,
Autoscale,
@@ -139,7 +140,7 @@ def __verify_values(self, expected_vals, actual_vals):
if len(expected_vals) != len(actual_vals):
return False
- keys = expected_vals.keys()
+ keys = list(expected_vals.keys())
for i in range(0, len(expected_vals)):
exp_val = expected_vals[keys[i]]
act_val = actual_vals[keys[i]]
@@ -195,7 +196,7 @@ def test_01_list_ipaddresses_pagination(self):
zoneid=self.zone.id
)
status = validateList(network_offerings_list)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"Isolated Network Offerings with sourceNat enabled are not found"
@@ -223,12 +224,12 @@ def test_01_list_ipaddresses_pagination(self):
type="Isolated"
)
status = validateList(networks_list_after)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"Network Creation Failed"
)
- self.assertEquals(
+ self.assertEqual(
1,
len(networks_list_after),
"Network creation failed"
@@ -260,7 +261,7 @@ def test_01_list_ipaddresses_pagination(self):
listall=self.services["listall"]
)
status = validateList(list_ipaddresses_after)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"IP Addresses Association Failed"
@@ -279,13 +280,13 @@ def test_01_list_ipaddresses_pagination(self):
pagesize=self.services["pagesize"]
)
status = validateList(list_ipaddress_page1)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"Failed to list IP Addresses in page1"
)
# Verifying that list size is equals to pagesize
- self.assertEquals(
+ self.assertEqual(
self.services["pagesize"],
len(list_ipaddress_page1),
"Failed to list pagesize number of IP Addresses in page1"
@@ -298,13 +299,13 @@ def test_01_list_ipaddresses_pagination(self):
pagesize=self.services["pagesize"]
)
status = validateList(list_ipaddress_page2)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"Failed to list IP Addresses in page2"
)
# Verifying that List size is equal to 1
- self.assertEquals(
+ self.assertEqual(
1,
len(list_ipaddress_page2),
"Failed to list IP Addresses in page2"
@@ -363,7 +364,7 @@ def test_02_list_ipaddresses_byid(self):
zoneid=self.zone.id
)
status = validateList(network_offerings_list)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"Isolated Network Offerings with sourceNat enabled are not found"
@@ -391,12 +392,12 @@ def test_02_list_ipaddresses_byid(self):
type="Isolated"
)
status = validateList(networks_list_after)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"Network Creation Failed"
)
- self.assertEquals(
+ self.assertEqual(
1,
len(networks_list_after),
"Network creation failed"
@@ -408,12 +409,12 @@ def test_02_list_ipaddresses_byid(self):
id=network.id
)
status = validateList(network_list_byid)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"Failed to list Network by Id"
)
- self.assertEquals(
+ self.assertEqual(
1,
len(network_list_byid),
"Failed to list Network by Id"
@@ -443,7 +444,7 @@ def test_02_list_ipaddresses_byid(self):
listall=self.services["listall"]
)
status = validateList(list_ipaddresses_after)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"IP Addresses Association Failed"
@@ -460,13 +461,13 @@ def test_02_list_ipaddresses_byid(self):
id=associated_ipaddress.ipaddress.id
)
status = validateList(list_ipaddress_byid)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"Failed to list IP Addresses by ID"
)
# Verifying that list size is equals to 1
- self.assertEquals(
+ self.assertEqual(
1,
len(list_ipaddress_byid),
"Failed to list IP Addresses by ID"
@@ -545,13 +546,13 @@ def test_03_associate_ipaddress_for_vpc(self):
# Listing the vpc for a user after creating a vpc
list_vpc_after = VPC.list(self.userapiclient)
status = validateList(list_vpc_after)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"list VPC not as expected"
)
# Verifying the list vpc size is increased by 1
- self.assertEquals(
+ self.assertEqual(
1,
len(list_vpc_after),
"list VPC not equal as expected"
@@ -562,12 +563,12 @@ def test_03_associate_ipaddress_for_vpc(self):
listall=self.services["listall"]
)
status = validateList(list_ipaddresses_before)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"Failed to List VPC IP Address"
)
- self.assertEquals(
+ self.assertEqual(
1,
len(list_ipaddresses_before),
"Failed to List VPC IP Address"
@@ -588,7 +589,7 @@ def test_03_associate_ipaddress_for_vpc(self):
listall=self.services["listall"]
)
status = validateList(list_ipaddresses_after)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"IP Addresses Association Failed"
@@ -608,13 +609,13 @@ def test_03_associate_ipaddress_for_vpc(self):
id=associated_ipaddress.ipaddress.id
)
status = validateList(list_ipaddress_byid)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"Failed to list IP Addresses by ID"
)
# Verifying that list size is equals to 1
- self.assertEquals(
+ self.assertEqual(
1,
len(list_ipaddress_byid),
"Failed to list IP Addresses by ID"
@@ -698,7 +699,7 @@ def test_04_create_delete_lbrule_fornonvpc(self):
zoneid=self.zone.id
)
status = validateList(network_offerings_list)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"Isolated Network Offerings with sourceNat, Lb enabled are\
@@ -744,7 +745,7 @@ def test_04_create_delete_lbrule_fornonvpc(self):
listall=self.services["listall"]
)
status = validateList(list_ipaddresses_after)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"IP Addresses Association Failed"
@@ -807,7 +808,7 @@ def test_04_create_delete_lbrule_fornonvpc(self):
publicipid=associated_ipaddress.ipaddress.id
)
status = validateList(list_lbrules_after)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"Load Balancer Rule creation Failed"
@@ -879,13 +880,13 @@ def test_05_create_delete_lbrule_forvpc(self):
# Listing the vpc for a user after creating a vpc
list_vpc_after = VPC.list(self.userapiclient)
status = validateList(list_vpc_after)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"list VPC not as expected"
)
# Verifying the list vpc size is increased by 1
- self.assertEquals(
+ self.assertEqual(
1,
len(list_vpc_after),
"list VPC not equal as expected"
@@ -899,7 +900,7 @@ def test_05_create_delete_lbrule_forvpc(self):
state="Enabled"
)
status = validateList(network_offering_vpc_true_list)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"Default network offering not present for vpc = true with Lb")
@@ -925,13 +926,13 @@ def test_05_create_delete_lbrule_forvpc(self):
listall=self.services["listall"]
)
status = validateList(list_ipaddresses_before)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"list IP Addresses not as expected"
)
# Verifying the list vpc size is increased by 1
- self.assertEquals(
+ self.assertEqual(
1,
len(list_ipaddresses_before),
"list IP Addresses not equal as expected"
@@ -952,7 +953,7 @@ def test_05_create_delete_lbrule_forvpc(self):
listall=self.services["listall"]
)
status = validateList(list_ipaddresses_after)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"IP Addresses Association Failed"
@@ -1016,7 +1017,7 @@ def test_05_create_delete_lbrule_forvpc(self):
publicipid=associated_ipaddress.ipaddress.id,
)
status = validateList(list_lbrules_after)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"Load Balancer Rule creation Failed"
@@ -1082,7 +1083,7 @@ def test_06_update_lbrule_name(self):
zoneid=self.zone.id
)
status = validateList(network_offerings_list)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"Isolated Network Offerings with sourceNat,\
@@ -1109,13 +1110,13 @@ def test_06_update_lbrule_name(self):
type="Isolated"
)
status = validateList(list_networks_after)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"Network Creation Failed"
)
# Verifying network list count is increased by 1
- self.assertEquals(
+ self.assertEqual(
1,
len(list_networks_after),
"Network Creation Failed"
@@ -1146,7 +1147,7 @@ def test_06_update_lbrule_name(self):
listall=self.services["listall"]
)
status = validateList(list_ipaddresses_after)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"IP Addresses Association Failed"
@@ -1186,7 +1187,7 @@ def test_06_update_lbrule_name(self):
publicipid=associated_ipaddress.ipaddress.id
)
status = validateList(list_lbrules_after)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"Load Balancer Rule creation Failed"
@@ -1291,7 +1292,7 @@ def test_07_assign_remove_lbrule_toinstance(self):
zoneid=self.zone.id
)
status = validateList(network_offerings_list)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"Isolated Network Offerings with sourceNat,\
@@ -1336,7 +1337,7 @@ def test_07_assign_remove_lbrule_toinstance(self):
listall=self.services["listall"]
)
status = validateList(list_ipaddresses_after)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"IP Addresses Association Failed"
@@ -1372,7 +1373,7 @@ def test_07_assign_remove_lbrule_toinstance(self):
networkid=network.id
)
status = validateList(list_vms_running)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"VM Created is not in Running state"
@@ -1383,7 +1384,7 @@ def test_07_assign_remove_lbrule_toinstance(self):
len(list_vms_running),
"VM Created is not in Running state"
)
- self.assertEquals(
+ self.assertEqual(
vm_created.id,
list_vms_running[0].id,
"VM Created is not in Running state"
@@ -1432,7 +1433,7 @@ def test_07_assign_remove_lbrule_toinstance(self):
publicipid=associated_ipaddress.ipaddress.id
)
status = validateList(list_lbrules_after)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"Load Balancer Rule creation Failed"
@@ -1463,7 +1464,7 @@ def test_07_assign_remove_lbrule_toinstance(self):
applied="false"
)
status = validateList(list_lbruleinstance_applied_false)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"No Instances are available to assign to Load Balancer Rule"
@@ -1475,7 +1476,7 @@ def test_07_assign_remove_lbrule_toinstance(self):
"No Instances are available to assign to Load Balancer Rule"
)
# Verifying that Instance created above is listed
- self.assertEquals(
+ self.assertEqual(
vm_created.id,
list_lbruleinstance_applied_false[0].id,
"Failed to list Instance available to asign a Load Balancer Rule"
@@ -1494,7 +1495,7 @@ def test_07_assign_remove_lbrule_toinstance(self):
applied="true"
)
status = validateList(list_lbruleinstance_applied_false)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"No Instances are available to assign to Load Balancer Rule"
@@ -1506,7 +1507,7 @@ def test_07_assign_remove_lbrule_toinstance(self):
"No Instances are available to assign to Load Balancer Rule"
)
# Verifying Instances is assigned to the Load Balancer Rule
- self.assertEquals(
+ self.assertEqual(
vm_created.id,
list_lbruleinstance_applied_true[0].id,
"Failed to assign Load Balancer Rule to given Instance"
@@ -1550,7 +1551,7 @@ def test_07_assign_remove_lbrule_toinstance(self):
applied="false"
)
status = validateList(list_lbruleinstance_applied_false)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"No Instances are available to assign to Load Balancer Rule"
@@ -1562,7 +1563,7 @@ def test_07_assign_remove_lbrule_toinstance(self):
"No Instances are available to assign to Load Balancer Rule"
)
# Verifying that Instance created above is listed
- self.assertEquals(
+ self.assertEqual(
vm_created.id,
list_lbruleinstance_applied_false[0].id,
"Failed to list Instance available to asign a Load Balancer Rule"
@@ -1615,7 +1616,7 @@ def test_08_list_create_delete_lbsticky_policy(self):
zoneid=self.zone.id
)
status = validateList(network_offerings_list)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"Isolated Network Offerings with sourceNat,\
@@ -1642,13 +1643,13 @@ def test_08_list_create_delete_lbsticky_policy(self):
type="Isolated"
)
status = validateList(list_networks_after)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"Network Creation Failed"
)
# Verifying network list count is increased by 1
- self.assertEquals(
+ self.assertEqual(
1,
len(list_networks_after),
"Network Creation Failed"
@@ -1679,7 +1680,7 @@ def test_08_list_create_delete_lbsticky_policy(self):
listall=self.services["listall"]
)
status = validateList(list_ipaddresses_after)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"IP Addresses Association Failed"
@@ -1719,7 +1720,7 @@ def test_08_list_create_delete_lbsticky_policy(self):
publicipid=associated_ipaddress.ipaddress.id
)
status = validateList(list_lbrules_after)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"Load Balancer Rule creation Failed"
@@ -1737,7 +1738,7 @@ def test_08_list_create_delete_lbsticky_policy(self):
listall=self.services["listall"]
)
# Verifying no Sticky Policies are listed
- self.assertEquals(
+ self.assertEqual(
0,
len(list_lbstickypolicy_before[0].stickinesspolicy),
"Sticky Policy listed for newly created Load Balancer Rule"
@@ -1785,7 +1786,7 @@ def test_08_list_create_delete_lbsticky_policy(self):
listall=self.services["listall"]
)
status = validateList(list_lbstickypolicy_after[0].stickinesspolicy)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"Load Balancer Sticky Policy creation Failed"
@@ -1809,7 +1810,7 @@ def test_08_list_create_delete_lbsticky_policy(self):
listall=self.services["listall"]
)
# Verifying no Sticky Policies are listed
- self.assertEquals(
+ self.assertEqual(
0,
len(list_lbstickypolicy_after[0].stickinesspolicy),
"Sticky Policy listed for newly created Load Balancer Rule"
@@ -1860,7 +1861,7 @@ def test_09_create_delete_portforwarding_fornonvpc(self):
zoneid=self.zone.id
)
status = validateList(network_offerings_list)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"Isolated Network Offerings with sourceNat,\
@@ -1905,7 +1906,7 @@ def test_09_create_delete_portforwarding_fornonvpc(self):
listall=self.services["listall"]
)
status = validateList(list_ipaddresses_after)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"IP Addresses Association Failed"
@@ -1938,7 +1939,7 @@ def test_09_create_delete_portforwarding_fornonvpc(self):
networkid=network.id
)
status = validateList(list_vms_running)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"VM Created is not in Running state"
@@ -1949,7 +1950,7 @@ def test_09_create_delete_portforwarding_fornonvpc(self):
len(list_ipaddresses_after),
"VM Created is not in Running state"
)
- self.assertEquals(
+ self.assertEqual(
vm_created.id,
list_vms_running[0].id,
"VM Created is not in Running state"
@@ -2018,7 +2019,7 @@ def test_09_create_delete_portforwarding_fornonvpc(self):
ipaddressid=associated_ipaddress.ipaddress.id
)
status = validateList(list_prtfwdrule_after)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"Failed to create Port Forwarding Rule"
@@ -2093,13 +2094,13 @@ def test_10_create_delete_portforwarding_forvpc(self):
# Listing the vpc for a user after creating a vpc
list_vpc_after = VPC.list(self.userapiclient)
status = validateList(list_vpc_after)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"list VPC not as expected"
)
# Verifying the list vpc size is increased by 1
- self.assertEquals(
+ self.assertEqual(
1,
len(list_vpc_after),
"list VPC not equal as expected"
@@ -2113,7 +2114,7 @@ def test_10_create_delete_portforwarding_forvpc(self):
state="Enabled"
)
status = validateList(network_offering_vpc_true_list)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"Default network offering not present for\
@@ -2138,13 +2139,13 @@ def test_10_create_delete_portforwarding_forvpc(self):
listall=self.services["listall"]
)
status = validateList(list_ipaddresses_before)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"list IP Addresses not as expected"
)
# Verifying the list vpc size is increased by 1
- self.assertEquals(
+ self.assertEqual(
1,
len(list_ipaddresses_before),
"list IP Addresses not equal as expected"
@@ -2165,7 +2166,7 @@ def test_10_create_delete_portforwarding_forvpc(self):
listall=self.services["listall"]
)
status = validateList(list_ipaddresses_after)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"IP Addresses Association Failed"
@@ -2244,7 +2245,7 @@ def test_10_create_delete_portforwarding_forvpc(self):
ipaddressid=associated_ipaddress.ipaddress.id
)
status = validateList(list_prtfwdrule_after)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"Failed to create Port Forwarding Rule"
@@ -2311,7 +2312,7 @@ def test_11_create_delete_firewallrule(self):
zoneid=self.zone.id
)
status = validateList(network_offerings_list)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"Isolated Network Offerings with sourceNat,\
@@ -2357,7 +2358,7 @@ def test_11_create_delete_firewallrule(self):
listall=self.services["listall"]
)
status = validateList(list_ipaddresses_after)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"IP Addresses Association Failed"
@@ -2424,7 +2425,7 @@ def test_11_create_delete_firewallrule(self):
ipaddressid=associated_ipaddress.ipaddress.id
)
status = validateList(list_firewalls_after)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"Failed to create Firewall Rule"
@@ -2492,7 +2493,7 @@ def test_12_create_delete_remoteaccessvpn(self):
zoneid=self.zone.id
)
status = validateList(network_offerings_list)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"Isolated Network Offerings with sourceNat,\
@@ -2538,7 +2539,7 @@ def test_12_create_delete_remoteaccessvpn(self):
listall=self.services["listall"]
)
status = validateList(list_ipaddresses_after)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"IP Addresses Association Failed"
@@ -2602,7 +2603,7 @@ def test_12_create_delete_remoteaccessvpn(self):
ipaddressid=associated_ipaddress.ipaddress.id
)
status = validateList(list_vpns_after)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"Failed to create Remote Access VPN"
@@ -2668,7 +2669,7 @@ def test_13_add_remove_vpnusers(self):
zoneid=self.zone.id
)
status = validateList(network_offerings_list)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"Isolated Network Offerings with sourceNat,\
@@ -2714,7 +2715,7 @@ def test_13_add_remove_vpnusers(self):
listall=self.services["listall"]
)
status = validateList(list_ipaddresses_after)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"IP Addresses Association Failed"
@@ -2768,7 +2769,7 @@ def test_13_add_remove_vpnusers(self):
ipaddressid=associated_ipaddress.ipaddress.id
)
status = validateList(list_vpns_after)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"Failed to create Remote Access VPN"
@@ -2811,7 +2812,7 @@ def test_13_add_remove_vpnusers(self):
domainid=self.domain.id
)
status = validateList(list_vpnusers_after)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"Failed to list VPN user after creation"
@@ -2877,7 +2878,7 @@ def test_14_enable_disable_staticnat_fornonvpc(self):
zoneid=self.zone.id
)
status = validateList(network_offerings_list)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"Isolated Network Offerings with sourceNat,\
@@ -2933,7 +2934,7 @@ def test_14_enable_disable_staticnat_fornonvpc(self):
listall=self.services["listall"]
)
status = validateList(list_ipaddresses_after)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"IP Addresses Association Failed"
@@ -2970,7 +2971,7 @@ def test_14_enable_disable_staticnat_fornonvpc(self):
listall=self.services["listall"]
)
status = validateList(list_ipaddress)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"Failed to List IP Address"
@@ -2981,7 +2982,7 @@ def test_14_enable_disable_staticnat_fornonvpc(self):
len(list_ipaddress),
"Failed to List IP Address"
)
- self.assertEquals(
+ self.assertEqual(
True,
list_ipaddress[0].isstaticnat,
"Failed to Enable Static Nat"
@@ -2998,7 +2999,7 @@ def test_14_enable_disable_staticnat_fornonvpc(self):
listall=self.services["listall"]
)
status = validateList(list_ipaddress)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"Failed to List IP Address"
@@ -3009,7 +3010,7 @@ def test_14_enable_disable_staticnat_fornonvpc(self):
len(list_ipaddress),
"Failed to List IP Address"
)
- self.assertEquals(
+ self.assertEqual(
False,
list_ipaddress[0].isstaticnat,
"Failed to Disable Static Nat"
@@ -3057,13 +3058,13 @@ def test_15_enable_disable_staticnat_forvpc(self):
# Listing the vpc for a user after creating a vpc
list_vpc_after = VPC.list(self.userapiclient)
status = validateList(list_vpc_after)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"list VPC not as expected"
)
# Verifying the list vpc size is increased by 1
- self.assertEquals(
+ self.assertEqual(
1,
len(list_vpc_after),
"list VPC not equal as expected"
@@ -3077,7 +3078,7 @@ def test_15_enable_disable_staticnat_forvpc(self):
state="Enabled"
)
status = validateList(network_offering_vpc_true_list)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"Default network offering not present\
@@ -3102,13 +3103,13 @@ def test_15_enable_disable_staticnat_forvpc(self):
listall=self.services["listall"]
)
status = validateList(list_ipaddresses_before)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"list IP Addresses not as expected"
)
# Verifying the list vpc size is increased by 1
- self.assertEquals(
+ self.assertEqual(
1,
len(list_ipaddresses_before),
"list IP Addresses not equal as expected"
@@ -3129,7 +3130,7 @@ def test_15_enable_disable_staticnat_forvpc(self):
listall=self.services["listall"]
)
status = validateList(list_ipaddresses_after)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"IP Addresses Association Failed"
@@ -3169,7 +3170,7 @@ def test_15_enable_disable_staticnat_forvpc(self):
listall=self.services["listall"]
)
status = validateList(list_ipaddress)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"Failed to List IP Address"
@@ -3180,7 +3181,7 @@ def test_15_enable_disable_staticnat_forvpc(self):
len(list_ipaddress),
"Failed to List IP Address"
)
- self.assertEquals(
+ self.assertEqual(
True,
list_ipaddress[0].isstaticnat,
"Failed to Enable Static Nat"
@@ -3197,7 +3198,7 @@ def test_15_enable_disable_staticnat_forvpc(self):
listall=self.services["listall"]
)
status = validateList(list_ipaddress)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"Failed to List IP Address"
@@ -3208,7 +3209,7 @@ def test_15_enable_disable_staticnat_forvpc(self):
len(list_ipaddress),
"Failed to List IP Address"
)
- self.assertEquals(
+ self.assertEqual(
False,
list_ipaddress[0].isstaticnat,
"Failed to Disable Static Nat"
@@ -3259,7 +3260,7 @@ def test_16_create_delete_ipforwardingrule(self):
zoneid=self.zone.id
)
status = validateList(network_offerings_list)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"Isolated Network Offerings with sourceNat,\
@@ -3315,7 +3316,7 @@ def test_16_create_delete_ipforwardingrule(self):
listall=self.services["listall"]
)
status = validateList(list_ipaddresses_after)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"IP Addresses Association Failed"
@@ -3352,7 +3353,7 @@ def test_16_create_delete_ipforwardingrule(self):
listall=self.services["listall"]
)
status = validateList(list_ipaddress)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"Failed to List IP Address"
@@ -3363,7 +3364,7 @@ def test_16_create_delete_ipforwardingrule(self):
len(list_ipaddress),
"Failed to List IP Address"
)
- self.assertEquals(
+ self.assertEqual(
True,
list_ipaddress[0].isstaticnat,
"Failed to Enable Static Nat"
@@ -3399,7 +3400,7 @@ def test_16_create_delete_ipforwardingrule(self):
ipaddressid=associated_ipaddress2.ipaddress.id
)
status = validateList(list_ipfwdrule_after)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"Failed to List IP Forwarding Rule after Creation"
@@ -3507,7 +3508,7 @@ def test_17_create_update_autoscalepolicy(self):
supportedservices="SourceNat,Lb",
zoneid=self.zone.id
)
- self.assertEquals(
+ self.assertEqual(
len(list_nwoff_before) + 1,
len(list_nwoff_after),
"Failed to create Network Offering"
@@ -3546,7 +3547,7 @@ def test_17_create_update_autoscalepolicy(self):
listall=self.services["listall"]
)
status = validateList(list_ipaddresses_before)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"IP Addresses Association Failed while launching a VM"
@@ -3573,7 +3574,7 @@ def test_17_create_update_autoscalepolicy(self):
listall=self.services["listall"]
)
status = validateList(list_ipaddresses_after)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"IP Addresses Association Failed"
@@ -3589,7 +3590,7 @@ def test_17_create_update_autoscalepolicy(self):
self.userapiclient,
)
status = validateList(list_counters)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"Failed to list counters"
@@ -3635,7 +3636,7 @@ def test_17_create_update_autoscalepolicy(self):
domainid=self.domain.id
)
status = validateList(list_conditions_after)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"Failed to list Conditions after creation"
@@ -3663,7 +3664,7 @@ def test_17_create_update_autoscalepolicy(self):
"Failed to create Autoscale VM Policy"
)
# Verifying autoscalepolicy is created using condition1
- self.assertEquals(
+ self.assertEqual(
condition_created1.id,
autoscalepolicy_created.conditions[0].id,
"Autoscale Policy not created by given condition"
@@ -3674,12 +3675,12 @@ def test_17_create_update_autoscalepolicy(self):
listall=self.services["listall"]
)
status = validateList(list_autoscalepolicies_after)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"Failed to list Autoscale Policy after creation"
)
- self.assertEquals(
+ self.assertEqual(
1,
len(list_autoscalepolicies_after),
"Autoscale Policies count is not matching"
@@ -3697,7 +3698,7 @@ def test_17_create_update_autoscalepolicy(self):
"Failed to update Autoscale Policy"
)
# Verifying the Autoscale Policy is updated
- self.assertEquals(
+ self.assertEqual(
condition_created2.id,
autoscalepolicy_updated.conditions[0].id,
"Autoscale Policy not updated to given condition"
@@ -3787,7 +3788,7 @@ def test_18_create_update_autoscaleprofiles(self):
supportedservices="SourceNat,Lb",
zoneid=self.zone.id
)
- self.assertEquals(
+ self.assertEqual(
len(list_nwoff_before) + 1,
len(list_nwoff_after),
"Failed to create Network Offering"
@@ -3826,7 +3827,7 @@ def test_18_create_update_autoscaleprofiles(self):
listall=self.services["listall"]
)
status = validateList(list_ipaddresses_before)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"IP Addresses Association Failed while launching a VM"
@@ -3853,7 +3854,7 @@ def test_18_create_update_autoscaleprofiles(self):
listall=self.services["listall"]
)
status = validateList(list_ipaddresses_after)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"IP Addresses Association Failed"
@@ -3871,7 +3872,7 @@ def test_18_create_update_autoscaleprofiles(self):
issystem='false'
)
status = validateList(list_service_offerings)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"Failed to list Service Offerings"
@@ -3884,7 +3885,7 @@ def test_18_create_update_autoscaleprofiles(self):
domainid=self.domain.id
)
status = validateList(list_users)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"Failed to list Users"
@@ -3897,7 +3898,7 @@ def test_18_create_update_autoscaleprofiles(self):
zoneid=self.zone.id
)
status = validateList(list_templates_featured)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"Failed to list Featured Templates"
@@ -3955,13 +3956,13 @@ def test_18_create_update_autoscaleprofiles(self):
listall=self.services["listall"]
)
status = validateList(list_autoscalevm_profiles_after)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"Failed to list Autoscale VM Profile after creation"
)
# Verifying only 1 autoscale vm profile is created
- self.assertEquals(
+ self.assertEqual(
1,
len(list_autoscalevm_profiles_after),
"Count of Autoscale VM profiles listed is not matching"
@@ -3973,7 +3974,7 @@ def test_18_create_update_autoscaleprofiles(self):
id=autoscalevm_profile.id
)
status = validateList(list_autoscalvmprofile)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"Failed to list Autoscale VM Profile by Id after creation"
@@ -4025,7 +4026,7 @@ def test_18_create_update_autoscaleprofiles(self):
)
# Verifyign that Destroy VM Graceperiod is updated in autoscale VM
# Profile
- self.assertEquals(
+ self.assertEqual(
200,
autoscalevm_profile_updated.destroyvmgraceperiod,
"Failed to update destroy vm grace period"
@@ -4114,7 +4115,7 @@ def test_19_create_update_autoscalevmgroup(self):
supportedservices="SourceNat,Lb",
zoneid=self.zone.id
)
- self.assertEquals(
+ self.assertEqual(
len(list_nwoff_before) + 1,
len(list_nwoff_after),
"Failed to create Network Offering"
@@ -4153,7 +4154,7 @@ def test_19_create_update_autoscalevmgroup(self):
listall=self.services["listall"]
)
status = validateList(list_ipaddresses_before)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"IP Addresses Association Failed while launching a VM"
@@ -4180,7 +4181,7 @@ def test_19_create_update_autoscalevmgroup(self):
listall=self.services["listall"]
)
status = validateList(list_ipaddresses_after)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"IP Addresses Association Failed"
@@ -4199,7 +4200,7 @@ def test_19_create_update_autoscalevmgroup(self):
domainid=self.domain.id
)
status = validateList(list_users)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"Failed to list Users"
@@ -4207,7 +4208,7 @@ def test_19_create_update_autoscalevmgroup(self):
# Listing counters
list_counters = Autoscale.listCounters(self.userapiclient)
status = validateList(list_counters)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"Failed to list Counters"
@@ -4320,13 +4321,13 @@ def test_19_create_update_autoscalevmgroup(self):
lbruleid=lbrule.id
)
status = validateList(list_vmgroup_after)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"Failed to list Autoscale VM group after creation"
)
# Verifying only 1 Autoscale VM group is listed
- self.assertEquals(
+ self.assertEqual(
1,
len(list_vmgroup_after),
"Autoscale VM group list count is not matching"
@@ -4341,7 +4342,7 @@ def test_19_create_update_autoscalevmgroup(self):
"Failed to disable Autoscale VM group"
)
# Verifyign the state of the VM Group afte renabling
- self.assertEquals(
+ self.assertEqual(
"disabled",
vmgroup_disabled.state,
"Disabled VM Group state is not matching"
@@ -4360,7 +4361,7 @@ def test_19_create_update_autoscalevmgroup(self):
vmgroup_updated,
"Failed to update Autoscale VM group"
)
- self.assertEquals(
+ self.assertEqual(
40,
vmgroup_updated.interval,
"Updated Autoscale VM group interval value is not matching"
@@ -4375,7 +4376,7 @@ def test_19_create_update_autoscalevmgroup(self):
"Failed to enable Autoscale VM group"
)
# Verifyign the state of the VM Group afte renabling
- self.assertEquals(
+ self.assertEqual(
"enabled",
vmgroup_enabled.state,
"Enabled VM Group state is not matching"
diff --git a/test/integration/component/test_escalations_isos.py b/test/integration/component/test_escalations_isos.py
index 4e818a5c3b8c..d1de07d98f83 100644
--- a/test/integration/component/test_escalations_isos.py
+++ b/test/integration/component/test_escalations_isos.py
@@ -121,7 +121,7 @@ def __verify_values(self, expected_vals, actual_vals):
if len(expected_vals) != len(actual_vals):
return False
- keys = expected_vals.keys()
+ keys = list(expected_vals.keys())
for i in range(0, len(expected_vals)):
exp_val = expected_vals[keys[i]]
act_val = actual_vals[keys[i]]
@@ -189,13 +189,13 @@ def test_01_list_isos_pagination(self):
isofilter=self.services["templatefilter"]
)
status = validateList(list_iso_after)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"ISO's creation failed"
)
# Verifying that list size is pagesize + 1
- self.assertEquals(
+ self.assertEqual(
self.services["pagesize"] + 1,
len(list_iso_after),
"Failed to create pagesize + 1 number of ISO's"
@@ -209,13 +209,13 @@ def test_01_list_isos_pagination(self):
pagesize=self.services["pagesize"]
)
status = validateList(list_iso_page1)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"Failed to list ISO's in page 1"
)
# Verifying the list size to be equal to pagesize
- self.assertEquals(
+ self.assertEqual(
self.services["pagesize"],
len(list_iso_page1),
"Size of ISO's in page 1 is not matching"
@@ -229,13 +229,13 @@ def test_01_list_isos_pagination(self):
pagesize=self.services["pagesize"]
)
status = validateList(list_iso_page2)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"Failed to list ISo's in page 2"
)
# Verifying the list size to be equal to 1
- self.assertEquals(
+ self.assertEqual(
1,
len(list_iso_page2),
"Size of ISO's in page 2 is not matching"
@@ -251,7 +251,7 @@ def test_01_list_isos_pagination(self):
id=iso_created.id
)
status = validateList(list_iso)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"Failed to list ISO by Id"
@@ -335,13 +335,13 @@ def test_02_download_iso(self):
isofilter=self.services["templatefilter"]
)
status = validateList(list_iso_after)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"ISO's creation failed"
)
# Verifying that list size is 1
- self.assertEquals(
+ self.assertEqual(
1,
len(list_iso_after),
"Failed to create an ISO's"
@@ -357,7 +357,7 @@ def test_02_download_iso(self):
id=iso_created.id
)
status = validateList(list_iso)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"Failed to list ISO by Id"
@@ -386,7 +386,7 @@ def test_02_download_iso(self):
"Download ISO failed"
)
# Verifying the details of downloaded ISO
- self.assertEquals(
+ self.assertEqual(
"DOWNLOAD_URL_CREATED",
download_iso.state,
"Download URL not created for ISO"
@@ -395,7 +395,7 @@ def test_02_download_iso(self):
download_iso.url,
"Download URL not created for ISO"
)
- self.assertEquals(
+ self.assertEqual(
iso_created.id,
download_iso.id,
"Download ISO details are not same as ISO created"
@@ -451,13 +451,13 @@ def test_03_edit_iso_details(self):
isofilter=self.services["templatefilter"]
)
status = validateList(list_iso_after)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"ISO's creation failed"
)
# Verifying that list size is 1
- self.assertEquals(
+ self.assertEqual(
1,
len(list_iso_after),
"Failed to create an ISO's"
@@ -473,7 +473,7 @@ def test_03_edit_iso_details(self):
id=iso_created.id
)
status = validateList(list_iso)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"Failed to list ISO by Id"
@@ -534,7 +534,7 @@ def test_03_edit_iso_details(self):
# Editing the ISO name, displaytext, ostypeid
ostype_list = list_os_types(self.userapiclient)
status = validateList(ostype_list)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"Failed to list OS Types"
@@ -618,7 +618,7 @@ def test_04_copy_iso(self):
available=True
)
status = validateList(zones_list)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"Failed to list Zones"
@@ -669,13 +669,13 @@ def test_04_copy_iso(self):
zoneid=zones_list[0].id
)
status = validateList(list_isos_zone1)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"ISO creation failed in Zone1"
)
# Verifying that list size is 1
- self.assertEquals(
+ self.assertEqual(
1,
len(list_isos_zone1),
"Failed to create a Template"
@@ -703,7 +703,7 @@ def test_04_copy_iso(self):
id=iso_created.id
)
status = validateList(list_iso)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"Failed to list ISO by Id"
@@ -739,13 +739,13 @@ def test_04_copy_iso(self):
zoneid=zones_list[0].id
)
status = validateList(list_isos_zone1)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"ISO creation failed in Zone1"
)
# Verifying that list size is 1
- self.assertEquals(
+ self.assertEqual(
1,
len(list_isos_zone1),
"Failed to create a Template"
@@ -758,23 +758,23 @@ def test_04_copy_iso(self):
zoneid=zones_list[1].id
)
status = validateList(list_isos_zone2)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"ISO failed to copy into Zone2"
)
# Verifying that list size is 1
- self.assertEquals(
+ self.assertEqual(
1,
len(list_isos_zone2),
"ISO failed to copy into Zone2"
)
- self.assertNotEquals(
+ self.assertNotEqual(
"Connection refused",
list_isos_zone2[0].status,
"Failed to copy ISO"
)
- self.assertEquals(
+ self.assertEqual(
True,
list_isos_zone2[0].isready,
"Failed to copy ISO"
diff --git a/test/integration/component/test_escalations_networks.py b/test/integration/component/test_escalations_networks.py
index 8be177ba8a51..e3095a1299b8 100644
--- a/test/integration/component/test_escalations_networks.py
+++ b/test/integration/component/test_escalations_networks.py
@@ -132,7 +132,7 @@ def __verify_values(self, expected_vals, actual_vals):
if len(expected_vals) != len(actual_vals):
return False
- keys = expected_vals.keys()
+ keys = list(expected_vals.keys())
for i in range(0, len(expected_vals)):
exp_val = expected_vals[keys[i]]
act_val = actual_vals[keys[i]]
@@ -168,7 +168,7 @@ def test_01_list_networks_pagination(self):
id=self.zone.id
)
status = validateList(list_zones)
- self.assertEquals(PASS, status[0], "No Zones found for a given id")
+ self.assertEqual(PASS, status[0], "No Zones found for a given id")
self.test_data["network_without_acl"]["zoneid"] = list_zones[0].id
# Listing the networks for a user
list_networks_before = Network.list(
@@ -226,7 +226,7 @@ def test_01_list_networks_pagination(self):
listall=self.test_data["listall"],
type="Isolated")
status = validateList(list_networks_after)
- self.assertEquals(PASS, status[0], "No networks found using list call")
+ self.assertEqual(PASS, status[0], "No networks found using list call")
# Asserting for the length of the networks
self.assertEqual(
len(list_networks_after),
@@ -242,7 +242,7 @@ def test_01_list_networks_pagination(self):
type="Isolated"
)
status = validateList(list_networks_page1)
- self.assertEquals(PASS, status[0], "No networks found at page 1")
+ self.assertEqual(PASS, status[0], "No networks found at page 1")
self.assertEqual(
len(list_networks_page1),
self.test_data["pagesize"],
@@ -257,7 +257,7 @@ def test_01_list_networks_pagination(self):
type="Isolated"
)
status = validateList(list_networks_page2)
- self.assertEquals(PASS, status[0], "No networks found at page 2")
+ self.assertEqual(PASS, status[0], "No networks found at page 2")
self.assertEqual(
len(list_networks_page2),
1,
@@ -267,7 +267,7 @@ def test_01_list_networks_pagination(self):
network_page2 = list_networks_page2[0]
for i in range(0, len(list_networks_page1)):
network_page1 = list_networks_page1[i]
- self.assertNotEquals(
+ self.assertNotEqual(
network_page2.id,
network_page1.id,
"Network listed in page 2 is also listed in page 1"
@@ -341,7 +341,7 @@ def test_03_list_vpc_pagination(self):
)
# verify no vpc is present for newly created user
status = validateList(vpc_list)
- self.assertEquals(FAIL, status[0], "VPCs found for newly created user")
+ self.assertEqual(FAIL, status[0], "VPCs found for newly created user")
for i in range(0, (self.test_data["pagesize"] + 1)):
vpc_1 = VPC.create(
self.userapiclient,
@@ -354,13 +354,13 @@ def test_03_list_vpc_pagination(self):
# verify vpc is created and not none
self.assertIsNotNone(vpc_1, "VPC is not created")
# Verify VPC name with test data
- self.assertNotEquals(
+ self.assertNotEqual(
-1,
vpc_1.name.find(self.test_data["vpc"]["name"]),
"VPC name not matched"
)
# verify zone with test data
- self.assertEquals(
+ self.assertEqual(
self.zone.id,
vpc_1.zoneid,
"Zone is not matching in the vpc created"
@@ -370,7 +370,7 @@ def test_03_list_vpc_pagination(self):
self.userapiclient,
listall=self.test_data["listall"])
status = validateList(vpc_count_after)
- self.assertEquals(PASS, status[0], "VPC list count is null")
+ self.assertEqual(PASS, status[0], "VPC list count is null")
self.assertEqual(
len(vpc_count_after),
(self.test_data["pagesize"] + 1),
@@ -384,7 +384,7 @@ def test_03_list_vpc_pagination(self):
pagesize=self.test_data["pagesize"]
)
status = validateList(list_vpcs_page1)
- self.assertEquals(PASS, status[0], "No vpcs found in Page 1")
+ self.assertEqual(PASS, status[0], "No vpcs found in Page 1")
self.assertEqual(
len(list_vpcs_page1),
self.test_data["pagesize"],
@@ -398,7 +398,7 @@ def test_03_list_vpc_pagination(self):
pagesize=self.test_data["pagesize"]
)
status = validateList(list_vpcs_page2)
- self.assertEquals(PASS, status[0], "No vpc found in Page 2")
+ self.assertEqual(PASS, status[0], "No vpc found in Page 2")
self.assertEqual(
1,
len(list_vpcs_page2),
@@ -410,7 +410,7 @@ def test_03_list_vpc_pagination(self):
# is not present in page1
for i in range(0, len(list_vpcs_page1)):
vpc_page1 = list_vpcs_page1[i]
- self.assertNotEquals(
+ self.assertNotEqual(
vpc_page2.id,
vpc_page1.id,
"VPC listed in page 2 is also listed in page 1"
@@ -456,7 +456,7 @@ def test_04_create_vpc_with_networkdomain(self):
)
# No VPCs should be present for newly created user
status = validateList(vpc_list)
- self.assertEquals(FAIL, status[0], "VPCs found for newly created user")
+ self.assertEqual(FAIL, status[0], "VPCs found for newly created user")
vpc_count_before = 0
vpc_1 = VPC.create(
self.userapiclient,
@@ -472,8 +472,8 @@ def test_04_create_vpc_with_networkdomain(self):
listall=self.test_data["listall"]
)
status = validateList(vpc_list)
- self.assertEquals(PASS, status[0], "VPC is not created")
- self.assertEquals(
+ self.assertEqual(PASS, status[0], "VPC is not created")
+ self.assertEqual(
vpc_count_before + 1,
len(vpc_list),
"VPC is not created"
@@ -500,7 +500,7 @@ def test_05_list_network_offerings_with_and_without_vpc(self):
network_offering_before_count = NetworkOffering.list(
self.userapiclient)
status = validateList(network_offering_before_count)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"Default network offering not present")
@@ -515,7 +515,7 @@ def test_05_list_network_offerings_with_and_without_vpc(self):
state="Enabled"
)
status = validateList(network_offering_vpc_true_before_count)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"Default network offering not present for vpc = true")
@@ -530,7 +530,7 @@ def test_05_list_network_offerings_with_and_without_vpc(self):
state="Enabled"
)
status = validateList(network_offering_vpc_false_before_count)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"Default network offering not present for vpc = false")
@@ -548,12 +548,12 @@ def test_05_list_network_offerings_with_and_without_vpc(self):
# List network offering
network_offering_after_count = NetworkOffering.list(self.userapiclient)
status = validateList(network_offering_after_count)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"Network Offering list results in null")
# Verify that count is incremented by 1
- self.assertEquals(
+ self.assertEqual(
len(network_offering_before_count) + 1,
len(network_offering_after_count),
"Network offering is not created"
@@ -569,12 +569,12 @@ def test_05_list_network_offerings_with_and_without_vpc(self):
state="Enabled"
)
status = validateList(network_offering_vpc_true_after_count)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"Network Offering list results in null")
# Verify that its count is same as step 1
- self.assertEquals(
+ self.assertEqual(
len(network_offering_vpc_true_before_count),
len(network_offering_vpc_true_after_count),
"Default Network offering is created with vpc as true"
@@ -590,12 +590,12 @@ def test_05_list_network_offerings_with_and_without_vpc(self):
state="Enabled"
)
status = validateList(network_offering_vpc_false_after_count)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"Network Offering list results in null")
# Verify that its count is same as step 3
- self.assertEquals(
+ self.assertEqual(
len(network_offering_vpc_false_before_count) + 1,
len(network_offering_vpc_false_after_count),
"Default Network offering is not created with vpc as false"
@@ -632,7 +632,7 @@ def test_06_create_network_in_vpc(self):
)
# No VPCs should be present for newly created user
status = validateList(vpc_list)
- self.assertEquals(FAIL, status[0], "VPCs found for newly created user")
+ self.assertEqual(FAIL, status[0], "VPCs found for newly created user")
vpc_count_before = 0
vpc_1 = VPC.create(
self.userapiclient,
@@ -647,8 +647,8 @@ def test_06_create_network_in_vpc(self):
listall=self.test_data["listall"]
)
status = validateList(vpc_list)
- self.assertEquals(PASS, status[0], "VPC is not created")
- self.assertEquals(
+ self.assertEqual(PASS, status[0], "VPC is not created")
+ self.assertEqual(
vpc_count_before + 1,
len(vpc_list),
"VPC is not created"
@@ -673,7 +673,7 @@ def test_06_create_network_in_vpc(self):
state="Enabled"
)
status = validateList(network_offering_vpc_true_list)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"Default network offering not present for vpc = true")
@@ -733,7 +733,7 @@ def test_06_create_network_in_vpc(self):
listall=self.test_data["listall"],
type="Isolated")
status = validateList(list_networks_after)
- self.assertEquals(PASS, status[0], "No networks found using list call")
+ self.assertEqual(PASS, status[0], "No networks found using list call")
# Asserting for the length of the networks
self.assertEqual(
2,
@@ -746,7 +746,7 @@ def test_06_create_network_in_vpc(self):
type="Isolated"
)
status = validateList(list_networks_in_vpc)
- self.assertEquals(PASS, status[0], "No networks found in vpc")
+ self.assertEqual(PASS, status[0], "No networks found in vpc")
# Asserting for the length of the networks
self.assertEqual(
1,
@@ -760,7 +760,7 @@ def test_06_create_network_in_vpc(self):
)
# verify no vpc is present for newly created user
status = validateList(vpc_list)
- self.assertEquals(PASS, status[0], "VPCs not found.")
+ self.assertEqual(PASS, status[0], "VPCs not found.")
# verify vpc name matches for newly created vpc name and vpc list name
self.assertEqual(
vpc_1.name,
@@ -799,7 +799,7 @@ def test_07_create_delete_network(self):
state="Enabled"
)
status = validateList(network_offering_vpc_false_list)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"Default network offering not present for vpc = false")
@@ -845,7 +845,7 @@ def test_07_create_delete_network(self):
type="Isolated"
)
status = validateList(list_networks_after)
- self.assertEquals(PASS, status[0], "No networks found using list call")
+ self.assertEqual(PASS, status[0], "No networks found using list call")
# Asserting for the length of the networks
self.assertEqual(
2,
@@ -861,14 +861,14 @@ def test_07_create_delete_network(self):
type="Isolated"
)
status = validateList(list_networks_after_delete)
- self.assertEquals(PASS, status[0], "No networks found using list call")
+ self.assertEqual(PASS, status[0], "No networks found using list call")
self.assertEqual(
1,
len(list_networks_after_delete),
"Number of networks created is not matching expected"
)
# Verify deleted network is not present
- self.assertNotEquals(
+ self.assertNotEqual(
network_created.id,
list_networks_after_delete[0].id,
"Deleted network present"
@@ -894,7 +894,7 @@ def test_08_update_network(self):
self.assertIsNotNone(
list_networks_before,
"Network create failed at class level")
- self.assertEquals(
+ self.assertEqual(
1,
len(list_networks_before),
"More than 1 network created at class level"
@@ -910,7 +910,7 @@ def test_08_update_network(self):
state="Enabled"
)
status = validateList(network_offering_vpc_false_list)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"Default network offering not present for vpc = false")
@@ -949,7 +949,7 @@ def test_08_update_network(self):
listall=self.test_data["listall"],
type="Isolated")
status = validateList(list_networks_after)
- self.assertEquals(PASS, status[0], "No networks found using list call")
+ self.assertEqual(PASS, status[0], "No networks found using list call")
# Asserting for the length of the networks
self.assertEqual(
2,
@@ -969,7 +969,7 @@ def test_08_update_network(self):
listall=self.test_data["listall"],
type="Isolated")
status = validateList(list_networks_after_update)
- self.assertEquals(PASS, status[0], "No networks found using list call")
+ self.assertEqual(PASS, status[0], "No networks found using list call")
self.assertEqual(
2,
len(list_networks_after_update),
@@ -1056,7 +1056,7 @@ def test_09_list_virtual_machines_single_network(self):
networkid=list_networks_before[0].id
)
status = validateList(list_instances_after)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"Listing of instances after creation failed"
@@ -1076,7 +1076,7 @@ def test_09_list_virtual_machines_single_network(self):
networkid=list_networks_before[0].id
)
status = validateList(list_instances_page1)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"Listing of instances in page1 failed"
@@ -1096,7 +1096,7 @@ def test_09_list_virtual_machines_single_network(self):
networkid=list_networks_before[0].id
)
status = validateList(list_instances_page2)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"Listing of instances in page2 failed"
@@ -1155,7 +1155,7 @@ def test_10_list_networks_in_vpc(self):
)
# No VPCs should be present for newly created user
status = validateList(vpc_list)
- self.assertEquals(FAIL, status[0], "VPCs found for newly created user")
+ self.assertEqual(FAIL, status[0], "VPCs found for newly created user")
vpc_count_before = 0
vpc_1 = VPC.create(
self.userapiclient,
@@ -1170,8 +1170,8 @@ def test_10_list_networks_in_vpc(self):
listall=self.test_data["listall"]
)
status = validateList(vpc_list)
- self.assertEquals(PASS, status[0], "VPC is not created")
- self.assertEquals(
+ self.assertEqual(PASS, status[0], "VPC is not created")
+ self.assertEqual(
vpc_count_before + 1,
len(vpc_list),
"VPC is not created"
@@ -1196,7 +1196,7 @@ def test_10_list_networks_in_vpc(self):
state="Enabled"
)
status = validateList(network_offering_vpc_true_list)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"Default network offering not present for vpc = true")
@@ -1246,7 +1246,7 @@ def test_10_list_networks_in_vpc(self):
listall=self.test_data["listall"],
type="Isolated")
status = validateList(list_networks_after)
- self.assertEquals(PASS, status[0], "No networks found using list call")
+ self.assertEqual(PASS, status[0], "No networks found using list call")
# Asserting for the length of the networks
self.assertEqual(
2,
@@ -1261,7 +1261,7 @@ def test_10_list_networks_in_vpc(self):
type="Isolated"
)
status = validateList(list_networks_in_vpc)
- self.assertEquals(PASS, status[0], "No networks found using list call")
+ self.assertEqual(PASS, status[0], "No networks found using list call")
# Verify network name matches for newly created network name and name
# from network list
self.assertEqual(
@@ -1298,7 +1298,7 @@ def test_11_update_vpc(self):
)
# verify no vpc is present for newly created user
status = validateList(vpc_list)
- self.assertEquals(FAIL, status[0], "VPCs found for newly created user")
+ self.assertEqual(FAIL, status[0], "VPCs found for newly created user")
vpc_1 = VPC.create(
self.userapiclient,
self.test_data["vpc"],
@@ -1309,13 +1309,13 @@ def test_11_update_vpc(self):
self.cleanup.append(vpc_1)
# verify vpc is created and not none
# Verify VPC name with test data
- self.assertNotEquals(
+ self.assertNotEqual(
-1,
vpc_1.name.find(self.test_data["vpc"]["name"]),
"VPC name not matched"
)
# verify zone with test data
- self.assertEquals(
+ self.assertEqual(
self.zone.id,
vpc_1.zoneid,
"Zone is not matching in the vpc created"
@@ -1325,7 +1325,7 @@ def test_11_update_vpc(self):
self.userapiclient,
listall=self.test_data["listall"])
status = validateList(vpc_count_after)
- self.assertEquals(PASS, status[0], "VPC list count is null")
+ self.assertEqual(PASS, status[0], "VPC list count is null")
self.assertEqual(
1,
len(vpc_count_after),
@@ -1344,7 +1344,7 @@ def test_11_update_vpc(self):
listall=self.test_data["listall"]
)
status = validateList(list_vpcs_after_update)
- self.assertEquals(PASS, status[0], "No vpcs found using list call")
+ self.assertEqual(PASS, status[0], "No vpcs found using list call")
self.assertEqual(
1,
len(list_vpcs_after_update),
@@ -1403,7 +1403,7 @@ def test_12_list_create_delete_networkACL(self):
)
# No VPCs should be present for newly created user
status = validateList(vpc_list)
- self.assertEquals(FAIL, status[0], "VPCs found for newly created user")
+ self.assertEqual(FAIL, status[0], "VPCs found for newly created user")
vpc_count_before = 0
vpc_1 = VPC.create(
self.userapiclient,
@@ -1418,8 +1418,8 @@ def test_12_list_create_delete_networkACL(self):
listall=self.test_data["listall"]
)
status = validateList(vpc_list)
- self.assertEquals(PASS, status[0], "VPC is not created")
- self.assertEquals(
+ self.assertEqual(PASS, status[0], "VPC is not created")
+ self.assertEqual(
vpc_count_before + 1,
len(vpc_list),
"VPC is not created"
@@ -1445,7 +1445,7 @@ def test_12_list_create_delete_networkACL(self):
state="Enabled"
)
status = validateList(network_offering_vpc_true_list)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"Default network offering not present for vpc = true")
@@ -1505,7 +1505,7 @@ def test_12_list_create_delete_networkACL(self):
listall=self.test_data["listall"],
type="Isolated")
status = validateList(list_networks_after)
- self.assertEquals(PASS, status[0], "No networks found using list call")
+ self.assertEqual(PASS, status[0], "No networks found using list call")
# Asserting for the length of the networks
self.assertEqual(
2,
@@ -1518,7 +1518,7 @@ def test_12_list_create_delete_networkACL(self):
type="Isolated"
)
status = validateList(list_networks_in_vpc)
- self.assertEquals(PASS, status[0], "No networks found in vpc")
+ self.assertEqual(PASS, status[0], "No networks found in vpc")
# Asserting for the length of the networks
self.assertEqual(
1,
@@ -1554,7 +1554,7 @@ def test_12_list_create_delete_networkACL(self):
networkid=network_created.id
)
status = validateList(list_network_acl)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"No networks acls found after creating")
@@ -1654,7 +1654,7 @@ def __verify_values(self, expected_vals, actual_vals):
if len(expected_vals) != len(actual_vals):
return False
- keys = expected_vals.keys()
+ keys = list(expected_vals.keys())
for i in range(0, len(expected_vals)):
exp_val = expected_vals[keys[i]]
act_val = actual_vals[keys[i]]
@@ -1703,13 +1703,13 @@ def test_13_list_vpc_byid(self):
# Listing the vpc for a user after creating a vpc
list_vpc_after = VPC.list(self.userapiclient)
status = validateList(list_vpc_after)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"list VPC not as expected"
)
# Verifying the list vpc size is increased by 1
- self.assertEquals(
+ self.assertEqual(
1,
len(list_vpc_after),
"list VPC not equal as expected"
@@ -1721,13 +1721,13 @@ def test_13_list_vpc_byid(self):
listall=self.test_data["listall"]
)
status = validateList(list_vpc_byid)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"list VPC not as expected"
)
# Verifying the list vpc size is 1
- self.assertEquals(
+ self.assertEqual(
1,
len(list_vpc_byid),
"list VPC not equal as expected"
@@ -1829,13 +1829,13 @@ def test_14_list_public_ipaddress_by_associated_networkid(self):
# ipaddress for network
list_public_ipaddress_after = PublicIPAddress.list(self.userapiclient)
status = validateList(list_public_ipaddress_after)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"list Public IPAddress not as expected"
)
# Verifying the list public ipaddress size is increased by 1
- self.assertEquals(
+ self.assertEqual(
1,
len(list_public_ipaddress_after),
"list Public IPAddress not equal as expected"
@@ -1847,13 +1847,13 @@ def test_14_list_public_ipaddress_by_associated_networkid(self):
listall=self.test_data["listall"]
)
status = validateList(list_public_ipaddress_byid)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"list public ipaddress not as expected"
)
# Verifying the list public ipaddress size is 1
- self.assertEquals(
+ self.assertEqual(
1,
len(list_public_ipaddress_byid),
"list public ipaddress not equal as expected"
@@ -1966,8 +1966,8 @@ def test_15_list_privategateway_byvpcid(self):
)
# Verifying PrivateGateways are listed
status = validateList(list_private_gateways_after)
- self.assertEquals(PASS, status[0], "Private Gateway Creation Failed")
- self.assertEquals(
+ self.assertEqual(PASS, status[0], "Private Gateway Creation Failed")
+ self.assertEqual(
1,
len(list_private_gateways_after),
"list Private Gateway not equal as expected"
@@ -1979,13 +1979,13 @@ def test_15_list_privategateway_byvpcid(self):
vpcid=vpc_created.id
)
status = validateList(list_privategateway_byvpcid)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"list private gateway not as expected"
)
# Verifying the list private gateway size is 1
- self.assertEquals(
+ self.assertEqual(
1,
len(list_privategateway_byvpcid),
"list private gateway not equal as expected"
@@ -2089,13 +2089,13 @@ def test_16_create_list_delete_egressfirewallrule_bynetworkid(self):
type="Isolated"
)
status = validateList(list_networks_after)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"Network Creation Failed"
)
# Verifying network list count is increased by 1
- self.assertEquals(
+ self.assertEqual(
1,
len(list_networks_after),
"Network Creation Failed"
@@ -2131,13 +2131,13 @@ def test_16_create_list_delete_egressfirewallrule_bynetworkid(self):
networkid=network.id
)
status = validateList(list_egressfirewallrule_bynetworkid)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"list EgressFirewall Rule not as expected"
)
# Verifying the list EgressFirewall Rule size is 1
- self.assertEquals(
+ self.assertEqual(
1,
len(list_egressfirewallrule_bynetworkid),
"list EgressFirewall Rule not equal as expected"
@@ -2215,13 +2215,13 @@ def test_17_restart_vpc(self):
# Listing the vpc for a user after creating a vpc
list_vpc_after = VPC.list(self.userapiclient)
status = validateList(list_vpc_after)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"list VPC not as expected"
)
# Verifying the list vpc size is increased by 1
- self.assertEquals(
+ self.assertEqual(
1,
len(list_vpc_after),
"list VPC not equal as expected"
@@ -2238,13 +2238,13 @@ def test_17_restart_vpc(self):
listall=self.test_data["listall"]
)
status = validateList(list_vpc_byid)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"list VPC not as expected"
)
# Verifying the list vpc size is 1
- self.assertEquals(
+ self.assertEqual(
1,
len(list_vpc_byid),
"list VPC not equal as expected"
@@ -2291,13 +2291,13 @@ def test_18_create_list_vpn_gateway(self):
# Listing the vpc for a user after creating a vpc
list_vpc_after = VPC.list(self.userapiclient)
status = validateList(list_vpc_after)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"list VPC not as expected"
)
# Verifying the list vpc size is increased by 1
- self.assertEquals(
+ self.assertEqual(
1,
len(list_vpc_after),
"list VPC not equal as expected"
@@ -2329,13 +2329,13 @@ def test_18_create_list_vpn_gateway(self):
vpcid=vpc_created.id
)
status = validateList(list_vpngateway_after)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"List VPN Gateway not equal as expected"
)
# Verifying that list size is 1
- self.assertEquals(
+ self.assertEqual(
1,
len(list_vpngateway_after
),
@@ -2410,13 +2410,13 @@ def test_19_create_list_reset_delete_vpnconnections(self):
# Listing the vpc for a user after creating a vpc
list_vpc_after = VPC.list(self.userapiclient)
status = validateList(list_vpc_after)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"list VPC not as expected"
)
# Verifying the list vpc size is increased by 1
- self.assertEquals(
+ self.assertEqual(
1,
len(list_vpc_after),
"list VPC not equal as expected"
@@ -2448,13 +2448,13 @@ def test_19_create_list_reset_delete_vpnconnections(self):
vpcid=vpc_created.id
)
status = validateList(list_vpngateway_after)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"List VPN Gateway not equal as expected"
)
# Verifying that list size is 1
- self.assertEquals(
+ self.assertEqual(
1,
len(list_vpngateway_after
),
@@ -2491,13 +2491,13 @@ def test_19_create_list_reset_delete_vpnconnections(self):
listall=self.test_data["listall"],
)
status = validateList(list_vpncustomergateways_after)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"VPN Customer Gateway list failed"
)
# Verifying that list size is 1
- self.assertEquals(
+ self.assertEqual(
1,
len(list_vpncustomergateways_after),
"Failed to list VPN Customer Gateways"
@@ -2530,13 +2530,13 @@ def test_19_create_list_reset_delete_vpnconnections(self):
vpcid=vpc_created.id
)
status = validateList(list_vpn_connection_after)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"list VPN Connection not as expected"
)
# Verifying the list vpn connection size is increased by 1
- self.assertEquals(
+ self.assertEqual(
1,
len(list_vpn_connection_after),
"list VPC Connection equal as expected"
@@ -2553,13 +2553,13 @@ def test_19_create_list_reset_delete_vpnconnections(self):
vpcid=vpc_created.id
)
status = validateList(list_vpn_connection_after_reset)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"list VPN Connection not as expected"
)
# Verifying the list vpn connection size is increased by 1
- self.assertEquals(
+ self.assertEqual(
1,
len(list_vpn_connection_after_reset),
"list VPN Connection not equal as expected"
@@ -2664,7 +2664,7 @@ def test_21_listNetworkacls_by_privategateway_aclid(self):
"Failed to list network acl list")
# Verfying list is not none
status = validateList(list_networkacl)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"Failed to list network acl list"
@@ -2711,8 +2711,8 @@ def test_21_listNetworkacls_by_privategateway_aclid(self):
)
# Verifying PrivateGateways are listed
status = validateList(list_private_gateways_after)
- self.assertEquals(PASS, status[0], "Failed to list Private Gateway")
- self.assertEquals(
+ self.assertEqual(PASS, status[0], "Failed to list Private Gateway")
+ self.assertEqual(
1,
len(list_private_gateways_after),
"list Private Gateway not equal as expected"
diff --git a/test/integration/component/test_escalations_securitygroups.py b/test/integration/component/test_escalations_securitygroups.py
index ffaf6571b958..7fa645e99e36 100644
--- a/test/integration/component/test_escalations_securitygroups.py
+++ b/test/integration/component/test_escalations_securitygroups.py
@@ -95,7 +95,7 @@ def __verify_values(self, expected_vals, actual_vals):
if len(expected_vals) != len(actual_vals):
return False
- keys = expected_vals.keys()
+ keys = list(expected_vals.keys())
for i in range(0, len(expected_vals)):
exp_val = expected_vals[keys[i]]
act_val = actual_vals[keys[i]]
@@ -134,13 +134,13 @@ def test_01_list_securitygroups_pagination(self):
)
# Verifying that default security group is created
status = validateList(list_securitygroups_before)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"Default Security Groups creation failed"
)
# Verifying the size of the list is 1
- self.assertEquals(
+ self.assertEqual(
1,
len(list_securitygroups_before),
"Count of Security Groups list is not matching"
@@ -167,13 +167,13 @@ def test_01_list_securitygroups_pagination(self):
listall=self.services["listall"]
)
status = validateList(list_securitygroups_after)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"Security Groups creation failed"
)
# Verifying that list size is pagesize + 1
- self.assertEquals(
+ self.assertEqual(
self.services["pagesize"] + 1,
len(list_securitygroups_after),
"Failed to create pagesize + 1 number of Security Groups"
@@ -186,13 +186,13 @@ def test_01_list_securitygroups_pagination(self):
pagesize=self.services["pagesize"]
)
status = validateList(list_securitygroups_page1)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"Failed to list security groups in page 1"
)
# Verifying the list size to be equal to pagesize
- self.assertEquals(
+ self.assertEqual(
self.services["pagesize"],
len(list_securitygroups_page1),
"Size of security groups in page 1 is not matching"
@@ -205,13 +205,13 @@ def test_01_list_securitygroups_pagination(self):
pagesize=self.services["pagesize"]
)
status = validateList(list_securitygroups_page2)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"Failed to list security groups in page 2"
)
# Verifying the list size to be equal to pagesize
- self.assertEquals(
+ self.assertEqual(
1,
len(list_securitygroups_page2),
"Size of security groups in page 2 is not matching"
@@ -262,13 +262,13 @@ def test_02_securitygroups_authorize_revoke_ingress(self):
)
# Verifying that default security group is created
status = validateList(list_securitygroups_before)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"Default Security Groups creation failed"
)
# Verifying the size of the list is 1
- self.assertEquals(
+ self.assertEqual(
1,
len(list_securitygroups_before),
"Count of Security Groups list is not matching"
@@ -293,13 +293,13 @@ def test_02_securitygroups_authorize_revoke_ingress(self):
listall=self.services["listall"]
)
status = validateList(list_securitygroups_after)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"Security Groups creation failed"
)
# Verifying that list size is 2
- self.assertEquals(
+ self.assertEqual(
2,
len(list_securitygroups_after),
"Failed to create Security Group"
@@ -320,13 +320,13 @@ def test_02_securitygroups_authorize_revoke_ingress(self):
)
# Verifying that security group is listed
status = validateList(list_securitygroups_byid)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"Listing of Security Groups by id failed"
)
# Verifying size of the list is 1
- self.assertEquals(
+ self.assertEqual(
1,
len(list_securitygroups_byid),
"Count of the listing security group by id is not matching"
@@ -334,12 +334,12 @@ def test_02_securitygroups_authorize_revoke_ingress(self):
securitygroup_ingress = list_securitygroups_byid[0].ingressrule
# Validating the Ingress rule
status = validateList(securitygroup_ingress)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"Security Groups Ingress rule authorization failed"
)
- self.assertEquals(
+ self.assertEqual(
1,
len(securitygroup_ingress),
"Security Group Ingress rules count is not matching"
@@ -378,13 +378,13 @@ def test_02_securitygroups_authorize_revoke_ingress(self):
)
# Verifying that security group is listed
status = validateList(list_securitygroups_byid)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"Listing of Security Groups by id failed"
)
# Verifying size of the list is 1
- self.assertEquals(
+ self.assertEqual(
1,
len(list_securitygroups_byid),
"Count of the listing security group by id is not matching"
@@ -392,7 +392,7 @@ def test_02_securitygroups_authorize_revoke_ingress(self):
securitygroup_ingress = list_securitygroups_byid[0].ingressrule
# Verifying that Ingress rule is empty(revoked)
status = validateList(securitygroup_ingress)
- self.assertEquals(
+ self.assertEqual(
EMPTY_LIST,
status[2],
"Security Groups Ingress rule is not revoked"
@@ -426,13 +426,13 @@ def test_03_securitygroups_authorize_revoke_egress(self):
)
# Verifying that default security group is created
status = validateList(list_securitygroups_before)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"Default Security Groups creation failed"
)
# Verifying the size of the list is 1
- self.assertEquals(
+ self.assertEqual(
1,
len(list_securitygroups_before),
"Count of Security Groups list is not matching"
@@ -457,13 +457,13 @@ def test_03_securitygroups_authorize_revoke_egress(self):
listall=self.services["listall"]
)
status = validateList(list_securitygroups_after)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"Security Groups creation failed"
)
# Verifying that list size is 2
- self.assertEquals(
+ self.assertEqual(
2,
len(list_securitygroups_after),
"Failed to create Security Group"
@@ -484,13 +484,13 @@ def test_03_securitygroups_authorize_revoke_egress(self):
)
# Verifying that security group is listed
status = validateList(list_securitygroups_byid)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"Listing of Security Groups by id failed"
)
# Verifying size of the list is 1
- self.assertEquals(
+ self.assertEqual(
1,
len(list_securitygroups_byid),
"Count of the listing security group by id is not matching"
@@ -498,12 +498,12 @@ def test_03_securitygroups_authorize_revoke_egress(self):
securitygroup_egress = list_securitygroups_byid[0].egressrule
# Validating the Ingress rule
status = validateList(securitygroup_egress)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"Security Groups Egress rule authorization failed"
)
- self.assertEquals(
+ self.assertEqual(
1,
len(securitygroup_egress),
"Security Group Egress rules count is not matching"
@@ -542,13 +542,13 @@ def test_03_securitygroups_authorize_revoke_egress(self):
)
# Verifying that security group is listed
status = validateList(list_securitygroups_byid)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"Listing of Security Groups by id failed"
)
# Verifying size of the list is 1
- self.assertEquals(
+ self.assertEqual(
1,
len(list_securitygroups_byid),
"Count of the listing security group by id is not matching"
@@ -556,7 +556,7 @@ def test_03_securitygroups_authorize_revoke_egress(self):
securitygroup_egress = list_securitygroups_byid[0].egressrule
# Verifying that Ingress rule is empty(revoked)
status = validateList(securitygroup_egress)
- self.assertEquals(
+ self.assertEqual(
EMPTY_LIST,
status[2],
"Security Groups Egress rule is not revoked"
diff --git a/test/integration/component/test_escalations_snapshots.py b/test/integration/component/test_escalations_snapshots.py
index 1e2b445d1e18..33ff79dadabe 100644
--- a/test/integration/component/test_escalations_snapshots.py
+++ b/test/integration/component/test_escalations_snapshots.py
@@ -16,7 +16,8 @@
# under the License.
# Import Local Modules
-from marvin.cloudstackTestCase import cloudstackTestCase, unittest
+from marvin.cloudstackTestCase import cloudstackTestCase
+import unittest
from marvin.lib.base import (VmSnapshot,
Snapshot,
DiskOffering,
@@ -138,7 +139,7 @@ def __verify_values(self, expected_vals, actual_vals):
if len(expected_vals) != len(actual_vals):
return False
- keys = expected_vals.keys()
+ keys = list(expected_vals.keys())
for i in range(0, len(expected_vals)):
exp_val = expected_vals[keys[i]]
act_val = actual_vals[keys[i]]
@@ -188,13 +189,13 @@ def test_01_list_volume_snapshots_pagination(self):
listall=self.services["listall"]
)
status = validateList(volumes_list)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"Root volume did not get created while deploying a VM"
)
# Verifying list size to be 1
- self.assertEquals(
+ self.assertEqual(
1,
len(volumes_list),
"More than 1 root volume created for deployed VM"
@@ -218,13 +219,13 @@ def test_01_list_volume_snapshots_pagination(self):
listall=self.services["listall"]
)
status = validateList(list_vol_snaps_after)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"Volume snapshot creation failed"
)
# Verifying that list size is pagesize + 1
- self.assertEquals(
+ self.assertEqual(
self.services["pagesize"] + 1,
len(list_vol_snaps_after),
"Failed to create pagesize + 1 number of Volume snapshots"
@@ -237,13 +238,13 @@ def test_01_list_volume_snapshots_pagination(self):
pagesize=self.services["pagesize"]
)
status = validateList(list_vol_snaps_page1)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"Failed to list volume snapshots in page 1"
)
# Verifying the list size to be equal to pagesize
- self.assertEquals(
+ self.assertEqual(
self.services["pagesize"],
len(list_vol_snaps_page1),
"Size of volume snapshots in page 1 is not matching"
@@ -256,13 +257,13 @@ def test_01_list_volume_snapshots_pagination(self):
pagesize=self.services["pagesize"]
)
status = validateList(list_vol_snaps_page2)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"Failed to list volume snapshots in page 2"
)
# Verifying the list size to be equal to pagesize
- self.assertEquals(
+ self.assertEqual(
1,
len(list_vol_snaps_page2),
"Size of volume snapshots in page 2 is not matching"
@@ -319,13 +320,13 @@ def test_02_list_volume_snapshots_byid(self):
listall=self.services["listall"]
)
status = validateList(volumes_list)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"Root volume did not get created while deploying a VM"
)
# Verifying list size to be 1
- self.assertEquals(
+ self.assertEqual(
1,
len(volumes_list),
"More than 1 root volume created for deployed VM"
@@ -347,13 +348,13 @@ def test_02_list_volume_snapshots_byid(self):
listall=self.services["listall"]
)
status = validateList(list_vol_snaps_after)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"Volume snapshot creation failed"
)
# Verifying that list size is 1
- self.assertEquals(
+ self.assertEqual(
1,
len(list_vol_snaps_after),
"Failed to create Volume snapshot"
@@ -365,13 +366,13 @@ def test_02_list_volume_snapshots_byid(self):
id=snapshot_created.id
)
status = validateList(list_vol_snapshot)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"Failed to list Volume snapshot by Id"
)
# Verifying that list size is 1
- self.assertEquals(
+ self.assertEqual(
1,
len(list_vol_snapshot),
"Size of the list volume snapshot by Id is not matching"
@@ -454,13 +455,13 @@ def test_03_list_vm_snapshots_pagination(self):
listall=self.services["listall"]
)
status = validateList(list_vm_snaps_after)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"VM snapshot creation failed"
)
# Verifying that list size is pagesize + 1
- self.assertEquals(
+ self.assertEqual(
self.services["pagesize"] + 1,
len(list_vm_snaps_after),
"Failed to create pagesize + 1 number of VM snapshots"
@@ -473,13 +474,13 @@ def test_03_list_vm_snapshots_pagination(self):
pagesize=self.services["pagesize"]
)
status = validateList(list_vm_snaps_page1)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"Failed to list vm snapshots in page 1"
)
# Verifying the list size to be equal to pagesize
- self.assertEquals(
+ self.assertEqual(
self.services["pagesize"],
len(list_vm_snaps_page1),
"Size of vm snapshots in page 1 is not matching"
@@ -492,13 +493,13 @@ def test_03_list_vm_snapshots_pagination(self):
pagesize=self.services["pagesize"]
)
status = validateList(list_vm_snaps_page2)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"Failed to list vm snapshots in page 2"
)
# Verifying the list size to be equal to pagesize
- self.assertEquals(
+ self.assertEqual(
1,
len(list_vm_snaps_page2),
"Size of vm snapshots in page 2 is not matching"
@@ -526,13 +527,13 @@ def test_03_list_vm_snapshots_pagination(self):
listall=self.services["listall"],
)
status = validateList(list_vm_snaps)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"All VM snapshots deleted"
)
# Verifying that list size is equal to page size
- self.assertEquals(
+ self.assertEqual(
self.services["pagesize"],
len(list_vm_snaps),
"VM Snapshots count is not matching"
@@ -586,13 +587,13 @@ def test_04_list_vm_snapshots_byid(self):
listall=self.services["listall"]
)
status = validateList(list_vm_snaps_after)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"VM snapshot creation failed"
)
# Verifying that list size is 1
- self.assertEquals(
+ self.assertEqual(
1,
len(list_vm_snaps_after),
"Failed to create VM snapshot"
@@ -604,13 +605,13 @@ def test_04_list_vm_snapshots_byid(self):
vmsnapshotid=snapshot_created.id
)
status = validateList(list_vm_snapshot)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"Failed to list VM snapshot by Id"
)
# Verifying that list size is 1
- self.assertEquals(
+ self.assertEqual(
1,
len(list_vm_snapshot),
"Size of the list vm snapshot by Id is not matching"
diff --git a/test/integration/component/test_escalations_templates.py b/test/integration/component/test_escalations_templates.py
index 12f98ac2cb11..bd7c41803458 100644
--- a/test/integration/component/test_escalations_templates.py
+++ b/test/integration/component/test_escalations_templates.py
@@ -16,7 +16,8 @@
# under the License.
# Import Local Modules
-from marvin.cloudstackTestCase import cloudstackTestCase, unittest
+from marvin.cloudstackTestCase import cloudstackTestCase
+import unittest
from marvin.lib.utils import (cleanup_resources,
validateList)
from marvin.lib.base import (Account,
@@ -118,7 +119,7 @@ def __verify_values(self, expected_vals, actual_vals):
if len(expected_vals) != len(actual_vals):
return False
- keys = expected_vals.keys()
+ keys = list(expected_vals.keys())
for i in range(0, len(expected_vals)):
exp_val = expected_vals[keys[i]]
act_val = actual_vals[keys[i]]
@@ -231,13 +232,13 @@ def test_01_list_templates_pagination(self):
templatefilter=self.services["templatefilter"]
)
status = validateList(list_templates_after)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"Templates creation failed"
)
# Verifying that list size is pagesize + 1
- self.assertEquals(
+ self.assertEqual(
self.services["pagesize"] + 1,
len(list_templates_after),
"Failed to create pagesize + 1 number of Templates"
@@ -251,13 +252,13 @@ def test_01_list_templates_pagination(self):
pagesize=self.services["pagesize"]
)
status = validateList(list_templates_page1)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"Failed to list Templates in page 1"
)
# Verifying the list size to be equal to pagesize
- self.assertEquals(
+ self.assertEqual(
self.services["pagesize"],
len(list_templates_page1),
"Size of Templates in page 1 is not matching"
@@ -271,13 +272,13 @@ def test_01_list_templates_pagination(self):
pagesize=self.services["pagesize"]
)
status = validateList(list_templates_page2)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"Failed to list Templates in page 2"
)
# Verifying the list size to be equal to 1
- self.assertEquals(
+ self.assertEqual(
1,
len(list_templates_page2),
"Size of Templates in page 2 is not matching"
@@ -354,13 +355,13 @@ def test_02_download_template(self):
templatefilter=self.services["templatefilter"]
)
status = validateList(list_templates_after)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"Templates creation failed"
)
# Verifying that list size is 1
- self.assertEquals(
+ self.assertEqual(
1,
len(list_templates_after),
"Failed to create a Template"
@@ -381,7 +382,7 @@ def test_02_download_template(self):
"Download Template failed"
)
# Verifying the details of downloaded template
- self.assertEquals(
+ self.assertEqual(
"DOWNLOAD_URL_CREATED",
download_template.state,
"Download URL not created for Template"
@@ -390,7 +391,7 @@ def test_02_download_template(self):
download_template.url,
"Download URL not created for Template"
)
- self.assertEquals(
+ self.assertEqual(
template_created.id,
download_template.id,
"Download Template details are not same as Template created"
@@ -453,13 +454,13 @@ def test_03_edit_template_details(self):
templatefilter=self.services["templatefilter"]
)
status = validateList(list_templates_after)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"Templates creation failed"
)
# Verifying that list size is 1
- self.assertEquals(
+ self.assertEqual(
1,
len(list_templates_after),
"Failed to create a Template"
@@ -551,7 +552,7 @@ def test_03_edit_template_details(self):
# Editing the Template ostypeid
ostype_list = list_os_types(self.userapiclient)
status = validateList(ostype_list)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"Failed to list OS Types"
@@ -716,7 +717,7 @@ def test_04_copy_template(self):
available=True
)
status = validateList(zones_list)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"Failed to list Zones"
@@ -756,7 +757,7 @@ def test_04_copy_template(self):
zoneid=zones_list[0].id
)
status = validateList(zones_list)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"Failed to list Hypervisors in Zone 1"
@@ -780,13 +781,13 @@ def test_04_copy_template(self):
zoneid=zones_list[0].id
)
status = validateList(list_templates_zone1)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"Templates creation failed in Zone1"
)
# Verifying that list size is 1
- self.assertEquals(
+ self.assertEqual(
1,
len(list_templates_zone1),
"Failed to create a Template"
@@ -825,13 +826,13 @@ def test_04_copy_template(self):
zoneid=zones_list[0].id
)
status = validateList(list_templates_zone1)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"Templates creation failed in Zone1"
)
# Verifying that list size is 1
- self.assertEquals(
+ self.assertEqual(
1,
len(list_templates_zone1),
"Failed to create a Template"
@@ -844,23 +845,23 @@ def test_04_copy_template(self):
zoneid=zones_list[1].id
)
status = validateList(list_templates_zone2)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"Template failed to copy into Zone2"
)
# Verifying that list size is 1
- self.assertEquals(
+ self.assertEqual(
1,
len(list_templates_zone2),
"Template failed to copy into Zone2"
)
- self.assertNotEquals(
+ self.assertNotEqual(
"Connection refused",
list_templates_zone2[0].status,
"Failed to copy Template"
)
- self.assertEquals(
+ self.assertEqual(
True,
list_templates_zone2[0].isready,
"Failed to copy Template"
diff --git a/test/integration/component/test_escalations_vmware.py b/test/integration/component/test_escalations_vmware.py
index 098ece07af45..e5e44b73ae13 100644
--- a/test/integration/component/test_escalations_vmware.py
+++ b/test/integration/component/test_escalations_vmware.py
@@ -252,7 +252,7 @@ def test2_attach_ISO_in_CentOSVM(self):
isready="true"
)
status = validateList(list_default_iso_response)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"ISO list is empty")
@@ -260,7 +260,7 @@ def test2_attach_ISO_in_CentOSVM(self):
"Registered a ISO with name {}".format(list_default_iso_response[0].name))
try:
vm.attach_iso(self.userapiclient,list_default_iso_response[0])
- except CloudstackAPIException as e:
+ except CloudstackAPIException as e:
self.fail("Attached ISO failed : %s" % e)
response = VirtualMachine.list(self.userapiclient, id=vm.id)
status = validateList(response)
@@ -316,7 +316,7 @@ def test3_attach_ISO_in_RHEL7OSVM(self):
isready="true"
)
status = validateList(list_default_iso_response)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"ISO list is empty")
@@ -324,7 +324,7 @@ def test3_attach_ISO_in_RHEL7OSVM(self):
"Registered a ISO with name {}".format(list_default_iso_response[0].name))
try:
vm.attach_iso(self.userapiclient,list_default_iso_response[0])
- except CloudstackAPIException as e:
+ except CloudstackAPIException as e:
self.fail("Attached ISO failed : %s" % e)
response = VirtualMachine.list(self.userapiclient, id=vm.id)
status = validateList(response)
diff --git a/test/integration/component/test_escalations_volumes.py b/test/integration/component/test_escalations_volumes.py
index b2e21f6be04e..6d62d31a689a 100644
--- a/test/integration/component/test_escalations_volumes.py
+++ b/test/integration/component/test_escalations_volumes.py
@@ -16,7 +16,8 @@
# under the License.
# Import Local Modules
-from marvin.cloudstackTestCase import cloudstackTestCase, unittest
+from marvin.cloudstackTestCase import cloudstackTestCase
+import unittest
from marvin.cloudstackAPI import createVolume, createTemplate
from marvin.lib.utils import (cleanup_resources,
random_gen, validateList)
@@ -149,7 +150,7 @@ def __verify_values(self, expected_vals, actual_vals):
if len(expected_vals) != len(actual_vals):
return False
- keys = expected_vals.keys()
+ keys = list(expected_vals.keys())
for i in range(0, len(expected_vals)):
exp_val = expected_vals[keys[i]]
act_val = actual_vals[keys[i]]
@@ -266,7 +267,7 @@ def test_01_list_volumes_pagination(self):
# Verifying that the volume on page 2 is not present in page1
for i in range(0, len(list_volumes_page1)):
volume_page1 = list_volumes_page1[i]
- self.assertNotEquals(
+ self.assertNotEqual(
volume_page2.id,
volume_page1.id,
"Volume listed in page 2 is also listed in page 1"
@@ -482,7 +483,7 @@ def test_03_data_volume_resize(self):
list_volumes_after = Volume.list(
self.userapiclient,
listall=self.services["listall"])
- self.assertEquals(
+ self.assertEqual(
len(list_volumes_before) + 1,
len(list_volumes_after),
"Data volume creation failed"
@@ -505,7 +506,7 @@ def test_03_data_volume_resize(self):
attached_volume.vmname,
"VM is not attached to Volume"
)
- self.assertEquals(
+ self.assertEqual(
self.virtual_machine.name,
attached_volume.vmname,
"VM Name is not matching with attached vm"
@@ -563,7 +564,7 @@ def test_03_data_volume_resize(self):
)
self.assertIsNotNone(resized_volume, "Resize Volume failed")
# Verifying data volume size is increased
- self.assertEquals(
+ self.assertEqual(
new_size,
(resized_volume.size / (1024 * 1024 * 1024)),
"volume not resized to expected value"
@@ -637,7 +638,7 @@ def test_04_custom_volume_resize(self):
# Verifyign that volume list is increased by 1 after creation of
# custion volume
- self.assertEquals(
+ self.assertEqual(
len(list_volumes_before) + 1,
len(list_volumes_after),
"Custom volume did not get created"
@@ -659,7 +660,7 @@ def test_04_custom_volume_resize(self):
attached_volume.vmname,
"VM is not attached to Volume"
)
- self.assertEquals(
+ self.assertEqual(
self.virtual_machine.name,
attached_volume.vmname,
"VM Name is not matching with attached vm"
@@ -691,7 +692,7 @@ def test_04_custom_volume_resize(self):
size=new_size)
self.assertIsNotNone(resized_volume, "Resize Volume failed")
# Verifying that custom disk size is increased
- self.assertEquals(
+ self.assertEqual(
new_size,
(resized_volume.size / (1024 * 1024 * 1024)),
"volume not resized to expected value"
@@ -731,7 +732,7 @@ def test_05_volume_snapshot(self):
self.userapiclient,
listall=self.services["listall"])
- self.assertEquals(
+ self.assertEqual(
len(list_volumes_before) + 1,
len(list_volumes_after),
"Volume not created"
@@ -753,7 +754,7 @@ def test_05_volume_snapshot(self):
attached_volume.vmname,
"VM is not attached to Volume"
)
- self.assertEquals(
+ self.assertEqual(
self.virtual_machine.name,
attached_volume.vmname,
"VM Name is not matching with attached vm"
@@ -911,7 +912,7 @@ def test_05_volume_snapshot(self):
self.userapiclient,
templatefilter='self')
- self.assertEquals(
+ self.assertEqual(
templates_before_size + 1,
len(list_templates_after),
"Template creation failed from snapshot"
@@ -955,7 +956,7 @@ def test_06_volume_snapshot_policy_hourly(self):
self.userapiclient,
listall=self.services["listall"])
- self.assertEquals(
+ self.assertEqual(
len(list_volumes_before) + 1,
len(list_volumes_after),
"Volume not created"
@@ -978,7 +979,7 @@ def test_06_volume_snapshot_policy_hourly(self):
attached_volume.vmname,
"VM is not attached to Volume"
)
- self.assertEquals(
+ self.assertEqual(
self.virtual_machine.name,
attached_volume.vmname,
"VM Name is not matching with attached vm"
@@ -1049,7 +1050,7 @@ def test_06_volume_snapshot_policy_hourly(self):
list_snapshot_policy_after,
"Hourly Snapshot policy creation failed"
)
- self.assertEquals(
+ self.assertEqual(
snapshot_policy_before_size + 1,
len(list_snapshot_policy_after),
"Hourly Snapshot policy creation failed"
@@ -1093,7 +1094,7 @@ def test_07_volume_snapshot_policy_daily(self):
self.userapiclient,
listall=self.services["listall"])
- self.assertEquals(
+ self.assertEqual(
len(list_volumes_before) + 1,
len(list_volumes_after),
"Volume not created"
@@ -1115,7 +1116,7 @@ def test_07_volume_snapshot_policy_daily(self):
attached_volume.vmname,
"VM is not attached to Volume"
)
- self.assertEquals(
+ self.assertEqual(
self.virtual_machine.name,
attached_volume.vmname,
"VM Name is not matching with attached vm"
@@ -1186,7 +1187,7 @@ def test_07_volume_snapshot_policy_daily(self):
list_snapshot_policy_after,
"Daily Snapshot policy creation failed"
)
- self.assertEquals(
+ self.assertEqual(
snapshot_policy_before_size + 1,
len(list_snapshot_policy_after),
"Daily Snapshot policy creation failed"
@@ -1230,7 +1231,7 @@ def test_08_volume_snapshot_policy_weekly(self):
self.userapiclient,
listall=self.services["listall"])
- self.assertEquals(
+ self.assertEqual(
len(list_volumes_before) + 1,
len(list_volumes_after),
"Volume not created"
@@ -1252,7 +1253,7 @@ def test_08_volume_snapshot_policy_weekly(self):
attached_volume.vmname,
"VM is not attached to Volume"
)
- self.assertEquals(
+ self.assertEqual(
self.virtual_machine.name,
attached_volume.vmname,
"VM Name is not matching with attached vm"
@@ -1323,7 +1324,7 @@ def test_08_volume_snapshot_policy_weekly(self):
list_snapshot_policy_after,
"Weekly Snapshot policy creation failed"
)
- self.assertEquals(
+ self.assertEqual(
snapshot_policy_before_size + 1,
len(list_snapshot_policy_after),
"Weekly Snapshot policy creation failed"
@@ -1369,7 +1370,7 @@ def test_09_volume_snapshot_policy_monthly(self):
self.userapiclient,
listall=self.services["listall"])
- self.assertEquals(
+ self.assertEqual(
len(list_volumes_before) + 1,
len(list_volumes_after),
"Volume not created"
@@ -1390,7 +1391,7 @@ def test_09_volume_snapshot_policy_monthly(self):
attached_volume.vmname,
"VM is not attached to Volume"
)
- self.assertEquals(
+ self.assertEqual(
self.virtual_machine.name,
attached_volume.vmname,
"VM Name is not matching with attached vm"
@@ -1459,7 +1460,7 @@ def test_09_volume_snapshot_policy_monthly(self):
list_snapshot_policy_after,
"Monthly Snapshot policy creation failed"
)
- self.assertEquals(
+ self.assertEqual(
snapshot_policy_before_size + 1,
len(list_snapshot_policy_after),
"Monthly Snapshot policy creation failed"
@@ -1518,7 +1519,7 @@ def test_10_volume_snapshots_pagination(self):
self.userapiclient,
listall=self.services["listall"])
- self.assertEquals(
+ self.assertEqual(
len(list_volumes_before) + 1,
len(list_volumes_after),
"Volume not created"
@@ -1539,7 +1540,7 @@ def test_10_volume_snapshots_pagination(self):
attached_volume.vmname,
"VM is not attached to Volume"
)
- self.assertEquals(
+ self.assertEqual(
self.virtual_machine.name,
attached_volume.vmname,
"VM Name is not matching with attached vm"
@@ -1579,7 +1580,7 @@ def test_10_volume_snapshots_pagination(self):
)
self.assertIsNotNone(snapshot_created, "Snapshot not created")
- self.assertEquals(
+ self.assertEqual(
volume_created.id,
snapshot_created.volumeid,
"Snapshot not created for given volume"
@@ -1630,7 +1631,7 @@ def test_10_volume_snapshots_pagination(self):
# Verifying that the snapshot on page 2 is not present in page1
for i in range(0, len(list_snapshots_page1)):
snapshot_page1 = list_snapshots_page1[i]
- self.assertNotEquals(
+ self.assertNotEqual(
snapshot_page2.id,
snapshot_page1.id,
"Snapshot listed in page 2 is also listed in page 1"
@@ -1705,7 +1706,7 @@ def test_11_volume_extract(self):
list_volumes_after,
"volume creation failed"
)
- self.assertEquals(
+ self.assertEqual(
len(list_volumes_before) + 1,
len(list_volumes_after),
"Volume not created"
@@ -1726,7 +1727,7 @@ def test_11_volume_extract(self):
attached_volume.vmname,
"VM is not attached to Volume"
)
- self.assertEquals(
+ self.assertEqual(
self.virtual_machine.name,
attached_volume.vmname,
"VM Name is not matching with attached vm"
@@ -1758,7 +1759,7 @@ def test_11_volume_extract(self):
extract_volume_response,
"Extract/Download volume failed")
- self.assertEquals(
+ self.assertEqual(
"DOWNLOAD_URL_CREATED",
extract_volume_response.state,
"Failed to create Download URL"
@@ -1771,7 +1772,7 @@ def test_11_volume_extract(self):
(extract_volume_response.url.find("http") != -1),
"Extract/Download volume URL doesnot contain http"
)
- self.assertEquals(
+ self.assertEqual(
volume_created.id,
extract_volume_response.id,
"Extracted/Downloaded volume is not matching with original volume"
@@ -1815,7 +1816,7 @@ def test_12_volume_upload(self):
"volume not created for the vm launched at class level"
)
# Asserting that the list volume length after upload is increased by 1
- self.assertEquals(
+ self.assertEqual(
len(list_volumes_before) + 1,
len(list_volumes_after),
"upload volume failed"
diff --git a/test/integration/component/test_escalations_vpncustomergateways.py b/test/integration/component/test_escalations_vpncustomergateways.py
index b09930ab099f..8c7cdd1c6001 100644
--- a/test/integration/component/test_escalations_vpncustomergateways.py
+++ b/test/integration/component/test_escalations_vpncustomergateways.py
@@ -120,7 +120,7 @@ def __verify_values(self, expected_vals, actual_vals):
if len(expected_vals) != len(actual_vals):
return False
- keys = expected_vals.keys()
+ keys = list(expected_vals.keys())
for i in range(0, len(expected_vals)):
exp_val = expected_vals[keys[i]]
act_val = actual_vals[keys[i]]
@@ -186,13 +186,13 @@ def test_01_list_vpncustomergateways_pagination(self):
listall=self.services["listall"]
)
status = validateList(list_vpncustomergateways_after)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"VPN Customer Gateway creation failed"
)
# Verifying that list size is pagesize + 1
- self.assertEquals(
+ self.assertEqual(
self.services["pagesize"] + 1,
len(list_vpncustomergateways_after),
"Failed to create pagesize + 1 number of VPN Customer Gateways"
@@ -205,13 +205,13 @@ def test_01_list_vpncustomergateways_pagination(self):
pagesize=self.services["pagesize"]
)
status = validateList(list_vpncustomergateways_page1)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"Failed to list VPN Customer Gateways in page 1"
)
# Verifying the list size to be equal to pagesize
- self.assertEquals(
+ self.assertEqual(
self.services["pagesize"],
len(list_vpncustomergateways_page1),
"Size of VPN Customer Gateways in page 1 is not matching"
@@ -224,13 +224,13 @@ def test_01_list_vpncustomergateways_pagination(self):
pagesize=self.services["pagesize"]
)
status = validateList(list_vpncustomergateways_page2)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"Failed to list VPN Customer Gateways in page 2"
)
# Verifying the list size to be equal to 1
- self.assertEquals(
+ self.assertEqual(
1,
len(list_vpncustomergateways_page2),
"Size of VPN Customer Gateways in page 2 is not matching"
@@ -301,13 +301,13 @@ def test_02_update_vpncustomergateways(self):
listall=self.services["listall"]
)
status = validateList(list_vpncustomergateways_after)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"VPN Customer Gateway creation failed"
)
# Verifying that list size is 1
- self.assertEquals(
+ self.assertEqual(
1,
len(list_vpncustomergateways_after),
"Failed to create VPN Customer Gateways"
@@ -332,13 +332,13 @@ def test_02_update_vpncustomergateways(self):
id=vpncustomergateway_created.id
)
status = validateList(list_vpncustomergateway)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"Failed to list VPN Customer Gateways by Id"
)
# Verifying the list size to be equal to 1
- self.assertEquals(
+ self.assertEqual(
1,
len(list_vpncustomergateway),
"Size of VPN Customer Gateways by id is not matching"
diff --git a/test/integration/component/test_haproxy.py b/test/integration/component/test_haproxy.py
index 25b169f6572e..5728ef07591b 100644
--- a/test/integration/component/test_haproxy.py
+++ b/test/integration/component/test_haproxy.py
@@ -412,7 +412,7 @@ def test_02_create_sticky_policy_custom_values(self):
self.virtual_machine_2],
services=services)
- for method, params in configs.items():
+ for method, params in list(configs.items()):
self.debug("Creating stickiness policy for the LB rule: %s" %
lb_rule.id)
policies = self.configure_Stickiness_Policy(lb_rule,
@@ -496,7 +496,7 @@ def test_04_delete_lb_rule(self):
#TODO: Add code to check the AppCookie and LbCookie Stickiness policies
configs = {"SourceBased": {"tablesize": '100k'}}
for lb_method in lb_methods:
- for method, params in configs.items():
+ for method, params in list(configs.items()):
self.debug("Creating load balancing rule on IP %s & algo %s" %
(self.public_ip.ipaddress.ipaddress, lb_method))
@@ -566,7 +566,7 @@ def test_05_error_alerts_after_create(self):
#TODO: Add code to check the AppCookie and LbCookie Stickiness policies
configs = {"SourceBased": {"tablesize": '100k'}}
for lb_method in lb_methods:
- for method, params in configs.items():
+ for method, params in list(configs.items()):
self.debug("Creating load balancing rule on IP %s & algo %s" %
(self.public_ip.ipaddress.ipaddress, lb_method))
@@ -632,7 +632,7 @@ def test_06_release_ip(self):
configs = {"SourceBased": {"tablesize": '100k'}}
for lb_method in lb_methods:
- for method, params in configs.items():
+ for method, params in list(configs.items()):
self.debug("Setting up environment - acquire public IP")
public_ip = self.acquire_Public_Ip()
diff --git a/test/integration/component/test_host.py b/test/integration/component/test_host.py
index c2a590a6117e..1778d799848f 100644
--- a/test/integration/component/test_host.py
+++ b/test/integration/component/test_host.py
@@ -14,7 +14,7 @@
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
-from __builtin__ import False
+from builtins import False
""" BVT tests for Hosts Test
"""
diff --git a/test/integration/component/test_host_ha.py b/test/integration/component/test_host_ha.py
index cb2a86998bf0..66ace6ecaa0c 100644
--- a/test/integration/component/test_host_ha.py
+++ b/test/integration/component/test_host_ha.py
@@ -14,7 +14,7 @@
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
-from __builtin__ import False
+from builtins import False
""" BVT tests for Hosts Maintenance
"""
@@ -198,7 +198,7 @@ def isOnlyNFSStorageAvailable(self):
"Check if listStoragePools returns a valid response"
)
for storage_pool in storage_pools:
- if storage_pool.type == u'NetworkFilesystem':
+ if storage_pool.type == 'NetworkFilesystem':
return True
return False
@@ -218,7 +218,7 @@ def isOnlyLocalStorageAvailable(self):
"Check if listStoragePools returns a valid response"
)
for storage_pool in storage_pools:
- if storage_pool.type == u'NetworkFilesystem':
+ if storage_pool.type == 'NetworkFilesystem':
return False
return True
@@ -238,7 +238,7 @@ def isLocalAndNFSStorageAvailable(self):
"Check if listStoragePools returns a valid response"
)
for storage_pool in storage_pools:
- if storage_pool.type == u'NetworkFilesystem':
+ if storage_pool.type == 'NetworkFilesystem':
return True
return False
diff --git a/test/integration/component/test_interop_xd_ccp.py b/test/integration/component/test_interop_xd_ccp.py
index 4b6b15d20104..6987b528f0e5 100644
--- a/test/integration/component/test_interop_xd_ccp.py
+++ b/test/integration/component/test_interop_xd_ccp.py
@@ -1156,10 +1156,10 @@ def test_17_deployvm_userdata_post(self):
domainid=self.account.domainid,
id=deployVmResponse.id
)
- self.assert_(len(vms) > 0, "There are no Vms deployed in the account %s" % self.account.name)
+ self.assertTrue(len(vms) > 0, "There are no Vms deployed in the account %s" % self.account.name)
vm = vms[0]
- self.assert_(vm.id == str(deployVmResponse.id), "Vm deployed is different from the test")
- self.assert_(vm.state == "Running", "VM is not in Running state")
+ self.assertTrue(vm.id == str(deployVmResponse.id), "Vm deployed is different from the test")
+ self.assertTrue(vm.state == "Running", "VM is not in Running state")
return
@attr(tags=["devcloud", "basic", "advanced"], required_hardware="true")
@@ -1181,10 +1181,10 @@ def test_18_deployvm_userdata(self):
domainid=self.account.domainid,
id=deployVmResponse.id
)
- self.assert_(len(vms) > 0, "There are no Vms deployed in the account %s" % self.account.name)
+ self.assertTrue(len(vms) > 0, "There are no Vms deployed in the account %s" % self.account.name)
vm = vms[0]
- self.assert_(vm.id == str(deployVmResponse.id), "Vm deployed is different from the test")
- self.assert_(vm.state == "Running", "VM is not in Running state")
+ self.assertTrue(vm.id == str(deployVmResponse.id), "Vm deployed is different from the test")
+ self.assertTrue(vm.state == "Running", "VM is not in Running state")
return
diff --git a/test/integration/component/test_ip_reservation.py b/test/integration/component/test_ip_reservation.py
index 14b6f5c8cd60..c5341516f3a0 100644
--- a/test/integration/component/test_ip_reservation.py
+++ b/test/integration/component/test_ip_reservation.py
@@ -22,7 +22,8 @@
Feature Specifications: https://cwiki.apache.org/confluence/display/CLOUDSTACK/FS+-+IP+Range+Reservation+within+a+Network
"""
-from marvin.cloudstackTestCase import cloudstackTestCase, unittest
+from marvin.cloudstackTestCase import cloudstackTestCase
+import unittest
from marvin.lib.utils import validateList, cleanup_resources, verifyRouterState
from marvin.lib.base import (Account,
Network,
@@ -762,7 +763,7 @@ def test_update_network_guestvmcidr(self, value):
try:
virtual_machine_1 = createVirtualMachine(self, network_id=isolated_network.id,
- ip_address=u"10.1."+random_subnet+".3")
+ ip_address="10.1."+random_subnet+".3")
except Exception as e:
self.fail("VM creation failed: %s" % e)
diff --git a/test/integration/component/test_lb_secondary_ip.py b/test/integration/component/test_lb_secondary_ip.py
index e1d885d62ef9..991466decd1c 100644
--- a/test/integration/component/test_lb_secondary_ip.py
+++ b/test/integration/component/test_lb_secondary_ip.py
@@ -30,7 +30,8 @@
# Import Local Modules
from nose.plugins.attrib import attr
-from marvin.cloudstackTestCase import cloudstackTestCase, unittest
+from marvin.cloudstackTestCase import cloudstackTestCase
+import unittest
from marvin.lib.base import (
Account,
ServiceOffering,
diff --git a/test/integration/component/test_ldap.py b/test/integration/component/test_ldap.py
index 1ebd98aaa133..5591d21ecc9d 100644
--- a/test/integration/component/test_ldap.py
+++ b/test/integration/component/test_ldap.py
@@ -89,7 +89,7 @@ def setUp(self):
else:
self.delflag = 1
self.acctRes = self.apiClient.createAccount(self.acct)
- self.assertEquals(self.delflag, 1, "LDAP account details are not provided,please check the configuration")
+ self.assertEqual(self.delflag, 1, "LDAP account details are not provided,please check the configuration")
return
def tearDown(self):
@@ -134,13 +134,13 @@ def test_01_addLdapConfiguration(self):
self.services["configurableData"]["ldap_configuration"]["ldapUsername"],
self.services["configurableData"]["ldap_configuration"]["ldapPassword"])
self.debug(loginRes)
- self.assertEquals(loginRes, 1, self.reason)
+ self.assertEqual(loginRes, 1, self.reason)
else:
self.debug("LDAP Configuration failed with exception")
- self.assertEquals(
+ self.assertEqual(
self.ldapconfRes,
1,
self.reason)
@@ -250,7 +250,7 @@ def _checkLdapConfiguration(self, ldapConfiguration):
tn = telnetlib.Telnet(ldapConfiguration['hostname'], ldapConfiguration['port'], timeout=15)
if tn is not None:
tn.set_debuglevel(1)
- print tn.msg("Connected to the server")
+ print(tn.msg("Connected to the server"))
self.debug("Ldap Server is Up and listening on the port %s" % tn.msg("Connected to the server"))
flag = True
tn.close()
diff --git a/test/integration/component/test_ldap_auto_import.py b/test/integration/component/test_ldap_auto_import.py
index b7b9e2a87b69..028e53db2c8b 100644
--- a/test/integration/component/test_ldap_auto_import.py
+++ b/test/integration/component/test_ldap_auto_import.py
@@ -143,7 +143,7 @@ def checkLdapConfiguration(cls, ldapConfiguration):
timeout=15)
if tn is not None:
tn.set_debuglevel(1)
- print tn.msg("Connected to the server")
+ print(tn.msg("Connected to the server"))
cls.debug(
"Ldap Server is Up and listening on the port %s" %
tn.msg("Connected to the server"))
@@ -251,7 +251,7 @@ def setUp(self):
else:
self.delflag1 = 1
self.ldaplinkRes = self.apiClient.linkDomainToLdap(self.ldaplink)
- self.assertEquals(
+ self.assertEqual(
self.delflag1,
1,
"Linking LDAP failed,please check the configuration")
@@ -260,7 +260,7 @@ def setUp(self):
self.parent_domain.name,
method="POST")
self.debug(loginRes)
- self.assertEquals(loginRes, 1, self.reason)
+ self.assertEqual(loginRes, 1, self.reason)
lsap_user = Account.list(self.api_client,
domainid=self.parent_domain.id,
@@ -328,7 +328,7 @@ def test_02_ldap(self):
self.parent_domain.name,
method="POST")
self.debug(loginRes)
- self.assertEquals(loginRes, 1, self.reason)
+ self.assertEqual(loginRes, 1, self.reason)
@attr(tags=["advanced", "basic"], required_hardware="true")
def test_03_ldap(self):
@@ -340,7 +340,7 @@ def test_03_ldap(self):
self.parent_domain.name,
method="POST")
self.debug(loginRes)
- self.assertEquals(loginRes, None, self.reason)
+ self.assertEqual(loginRes, None, self.reason)
@attr(tags=["advanced", "basic"], required_hardware="true")
def test_04_ldap(self):
@@ -353,7 +353,7 @@ def test_04_ldap(self):
"",
method="POST")
self.debug(loginRes)
- self.assertEquals(loginRes, None, self.reason)
+ self.assertEqual(loginRes, None, self.reason)
@attr(tags=["advanced", "basic"], required_hardware="true")
def test_05_ldap(self):
@@ -362,7 +362,7 @@ def test_05_ldap(self):
self.parent_domain.name,
method="POST")
self.debug(loginRes)
- self.assertEquals(loginRes, None, self.reason)
+ self.assertEqual(loginRes, None, self.reason)
@attr(tags=["advanced", "basic"], required_hardware="true")
def test_06_ldap(self):
@@ -395,7 +395,7 @@ def test_06_ldap(self):
self.parent_domain.name,
method="POST")
self.debug(loginRes)
- self.assertEquals(loginRes, 1, self.reason)
+ self.assertEqual(loginRes, 1, self.reason)
@attr(tags=["advanced", "basic"], required_hardware="true")
def test_07_ldap(self):
@@ -414,7 +414,7 @@ def test_07_ldap(self):
self.parent_domain.name,
method="POST")
self.debug(loginRes)
- self.assertEquals(loginRes, None, self.reason)
+ self.assertEqual(loginRes, None, self.reason)
@attr(tags=["advanced", "basic"], required_hardware="true")
def test_08_ldap(self):
@@ -428,7 +428,7 @@ def test_08_ldap(self):
self.parent_domain.name,
method="POST")
self.debug(loginRes)
- self.assertEquals(loginRes, 1, self.reason)
+ self.assertEqual(loginRes, 1, self.reason)
self.domain2 = Domain.create(
self.apiclient,
@@ -465,7 +465,7 @@ def test_08_ldap(self):
self.delflag2 = 1
self.ldaplinkRes2 = self.apiClient.linkDomainToLdap(
self.ldaplink2)
- self.assertEquals(
+ self.assertEqual(
self.delflag2,
1,
"Linking LDAP failed,please check the configuration")
@@ -477,7 +477,7 @@ def test_08_ldap(self):
self.domain2.name,
method="POST")
self.debug(loginRes)
- self.assertEquals(loginRes, 1, self.reason)
+ self.assertEqual(loginRes, 1, self.reason)
self.domain3 = Domain.create(
self.apiclient,
@@ -511,7 +511,7 @@ def test_08_ldap(self):
self.delflag3 = 1
self.ldaplinkRes3 = self.apiClient.linkDomainToLdap(
self.ldaplink3)
- self.assertEquals(
+ self.assertEqual(
self.delflag3,
1,
"Linking LDAP failed,please check the configuration")
@@ -522,7 +522,7 @@ def test_08_ldap(self):
self.domain2.name,
method="POST")
self.debug(loginRes)
- self.assertEquals(loginRes, 1, self.reason)
+ self.assertEqual(loginRes, 1, self.reason)
finally:
try:
@@ -556,7 +556,7 @@ def test_09_ldap(self):
self.parent_domain.name,
method="POST")
self.debug(loginRes)
- self.assertEquals(loginRes, 1, self.reason)
+ self.assertEqual(loginRes, 1, self.reason)
@attr(tags=["advanced", "basic"], required_hardware="true")
def test_10_ldap(self):
@@ -584,7 +584,7 @@ def test_10_ldap(self):
dbChecking[0][2]) == \
self.services["configurableData"]["link_ldap_details"]["accounttype"]:
db_check = 0
- self.assertEquals(db_check, 0, "DB check failed")
+ self.assertEqual(db_check, 0, "DB check failed")
@attr(tags=["advanced", "basic"], required_hardware="true")
def test_11_ldap(self):
@@ -593,6 +593,6 @@ def test_11_ldap(self):
self,
"", "", self.parent_domain.name, method="POST")
self.debug(loginRes)
- self.assertEquals(loginRes, None, self.reason)
+ self.assertEqual(loginRes, None, self.reason)
diff --git a/test/integration/component/test_list_nics.py b/test/integration/component/test_list_nics.py
index 12bae1fa2ea7..a93c07bfc4b3 100644
--- a/test/integration/component/test_list_nics.py
+++ b/test/integration/component/test_list_nics.py
@@ -147,4 +147,4 @@ def tearDown(self):
cleanup_resources(self.apiclient, self.cleanup)
except Exception as e:
self.debug("Warning! Exception in tearDown: %s" % e)
- return
\ No newline at end of file
+ return
diff --git a/test/integration/component/test_list_pod.py b/test/integration/component/test_list_pod.py
index 07ab2c589afe..ac8a8895c6b3 100644
--- a/test/integration/component/test_list_pod.py
+++ b/test/integration/component/test_list_pod.py
@@ -19,7 +19,8 @@
"""
from nose.plugins.attrib import attr
-from marvin.cloudstackTestCase import cloudstackTestCase, unittest
+from marvin.cloudstackTestCase import cloudstackTestCase
+import unittest
from marvin.lib.utils import (cleanup_resources)
from marvin.lib.base import (Pod, Cluster, Capacities)
from marvin.cloudstackAPI import (updateConfiguration)
diff --git a/test/integration/component/test_memory_limits.py b/test/integration/component/test_memory_limits.py
index 4e7e5cc43235..fca2ca610094 100644
--- a/test/integration/component/test_memory_limits.py
+++ b/test/integration/component/test_memory_limits.py
@@ -18,7 +18,8 @@
"""
# Import Local Modules
from nose.plugins.attrib import attr
-from marvin.cloudstackTestCase import cloudstackTestCase, unittest
+from marvin.cloudstackTestCase import cloudstackTestCase
+import unittest
from marvin.lib.base import (
Account,
ServiceOffering,
@@ -499,7 +500,7 @@ def test_01_stop_start_instance(self):
users = {self.child_domain_1: self.child_do_admin_1,
self.child_domain_2: self.child_do_admin_2
}
- for domain, admin in users.items():
+ for domain, admin in list(users.items()):
self.account = admin
self.domain = domain
@@ -574,7 +575,7 @@ def test_02_migrate_instance(self):
users = {self.child_domain_1: self.child_do_admin_1,
self.child_domain_2: self.child_do_admin_2
}
- for domain, admin in users.items():
+ for domain, admin in list(users.items()):
self.account = admin
self.domain = domain
@@ -634,7 +635,7 @@ def test_03_delete_instance(self):
users = {self.child_domain_1: self.child_do_admin_1,
self.child_domain_2: self.child_do_admin_2
}
- for domain, admin in users.items():
+ for domain, admin in list(users.items()):
self.account = admin
self.domain = domain
@@ -698,7 +699,7 @@ def test_04_deploy_multiple_vm(self):
users = {self.child_domain_1: self.child_do_admin_1,
self.child_domain_2: self.child_do_admin_2
}
- for domain, admin in users.items():
+ for domain, admin in list(users.items()):
self.account = admin
self.domain = domain
diff --git a/test/integration/component/test_mm_domain_limits.py b/test/integration/component/test_mm_domain_limits.py
index 51e92ce67f18..724a87b53491 100644
--- a/test/integration/component/test_mm_domain_limits.py
+++ b/test/integration/component/test_mm_domain_limits.py
@@ -18,7 +18,8 @@
"""
# Import Local Modules
from nose.plugins.attrib import attr
-from marvin.cloudstackTestCase import cloudstackTestCase, unittest
+from marvin.cloudstackTestCase import cloudstackTestCase
+import unittest
from marvin.lib.base import (
Account,
ServiceOffering,
@@ -225,7 +226,7 @@ def test_01_change_service_offering(self):
users = { self.child_domain_1: self.child_do_admin_1,
self.child_domain_2: self.child_do_admin_2
}
- for domain, admin in users.items():
+ for domain, admin in list(users.items()):
self.account = admin
self.domain = domain
@@ -369,7 +370,7 @@ def test_02_migrate_vm(self):
users = { self.child_domain_1: self.child_do_admin_1,
self.child_domain_2: self.child_do_admin_2
}
- for domain, admin in users.items():
+ for domain, admin in list(users.items()):
self.account = admin
self.domain = domain
self.debug("Creating an instance with service offering: %s" %
@@ -430,7 +431,7 @@ def test_03_delete_vm(self):
users = { self.child_domain_1: self.child_do_admin_1,
self.child_domain_2: self.child_do_admin_2
}
- for domain, admin in users.items():
+ for domain, admin in list(users.items()):
self.account = admin
self.domain = domain
self.debug("Creating an instance with service offering: %s" %
@@ -490,7 +491,7 @@ def test_04_deploy_multiple_vm(self):
users = { self.child_domain_1: self.child_do_admin_1,
self.child_domain_2: self.child_do_admin_2
}
- for domain, admin in users.items():
+ for domain, admin in list(users.items()):
self.account = admin
self.domain = domain
self.debug("Creating an instance with service offering: %s" %
diff --git a/test/integration/component/test_mm_max_limits.py b/test/integration/component/test_mm_max_limits.py
index e08052b2f8e2..b831e0b0ab3b 100644
--- a/test/integration/component/test_mm_max_limits.py
+++ b/test/integration/component/test_mm_max_limits.py
@@ -18,7 +18,8 @@
"""
# Import Local Modules
from nose.plugins.attrib import attr
-from marvin.cloudstackTestCase import cloudstackTestCase, unittest
+from marvin.cloudstackTestCase import cloudstackTestCase
+import unittest
from marvin.lib.base import (
Account,
ServiceOffering,
diff --git a/test/integration/component/test_mm_project_limits.py b/test/integration/component/test_mm_project_limits.py
index 0d5b282f5b4c..09acf058669c 100644
--- a/test/integration/component/test_mm_project_limits.py
+++ b/test/integration/component/test_mm_project_limits.py
@@ -18,7 +18,8 @@
"""
# Import Local Modules
from nose.plugins.attrib import attr
-from marvin.cloudstackTestCase import cloudstackTestCase, unittest
+from marvin.cloudstackTestCase import cloudstackTestCase
+import unittest
from marvin.lib.base import (
Account,
ServiceOffering,
diff --git a/test/integration/component/test_multiple_nic_support.py b/test/integration/component/test_multiple_nic_support.py
index cf3a23364957..5d4ee03d2c0c 100644
--- a/test/integration/component/test_multiple_nic_support.py
+++ b/test/integration/component/test_multiple_nic_support.py
@@ -19,7 +19,8 @@
"""
# Import Local Modules
from nose.plugins.attrib import attr
-from marvin.cloudstackTestCase import cloudstackTestCase, unittest
+from marvin.cloudstackTestCase import cloudstackTestCase
+import unittest
from marvin.sshClient import SshClient
from marvin.lib.utils import (validateList,
cleanup_resources,
diff --git a/test/integration/component/test_multiple_public_interfaces.py b/test/integration/component/test_multiple_public_interfaces.py
index 311646536542..91db55f6a6e2 100644
--- a/test/integration/component/test_multiple_public_interfaces.py
+++ b/test/integration/component/test_multiple_public_interfaces.py
@@ -1011,7 +1011,7 @@ def create_network(self, net_offerring, gateway='10.1.1.1',vpc=None):
)
logger.debug("Created network with ID: %s" % obj_network.id)
return obj_network
- except Exception, e:
+ except Exception as e:
self.fail('Unable to create a Network with offering=%s because of %s ' % (net_offerring, e))
def deployvm_in_network(self, network, host_id=None):
@@ -1231,7 +1231,7 @@ def create_network(self, net_offerring, gateway='10.1.1.1',vpc=None):
)
logger.debug("Created network with ID: %s" % obj_network.id)
return obj_network
- except Exception, e:
+ except Exception as e:
self.fail('Unable to create a Network with offering=%s because of %s ' % (net_offerring, e))
def deployvm_in_network(self, network, host_id=None):
diff --git a/test/integration/component/test_multiple_subnets_in_isolated_network.py b/test/integration/component/test_multiple_subnets_in_isolated_network.py
index 9cbd3bb2fba4..4c6312888541 100644
--- a/test/integration/component/test_multiple_subnets_in_isolated_network.py
+++ b/test/integration/component/test_multiple_subnets_in_isolated_network.py
@@ -21,7 +21,8 @@
from nose.plugins.attrib import attr
from marvin.cloudstackAPI import rebootRouter
-from marvin.cloudstackTestCase import cloudstackTestCase, unittest
+from marvin.cloudstackTestCase import cloudstackTestCase
+import unittest
from marvin.lib.utils import (validateList,
get_host_credentials,
get_process_status,
diff --git a/test/integration/component/test_multiple_subnets_in_isolated_network_rvr.py b/test/integration/component/test_multiple_subnets_in_isolated_network_rvr.py
index 7b58e003e4a0..3ede4cf1eded 100644
--- a/test/integration/component/test_multiple_subnets_in_isolated_network_rvr.py
+++ b/test/integration/component/test_multiple_subnets_in_isolated_network_rvr.py
@@ -21,7 +21,8 @@
from nose.plugins.attrib import attr
from marvin.cloudstackAPI import rebootRouter
-from marvin.cloudstackTestCase import cloudstackTestCase, unittest
+from marvin.cloudstackTestCase import cloudstackTestCase
+import unittest
from marvin.lib.utils import (validateList,
get_host_credentials,
get_process_status,
diff --git a/test/integration/component/test_multiple_subnets_in_vpc.py b/test/integration/component/test_multiple_subnets_in_vpc.py
index eaa42169771f..57da7288a1f1 100644
--- a/test/integration/component/test_multiple_subnets_in_vpc.py
+++ b/test/integration/component/test_multiple_subnets_in_vpc.py
@@ -21,7 +21,8 @@
from nose.plugins.attrib import attr
from marvin.cloudstackAPI import rebootRouter
-from marvin.cloudstackTestCase import cloudstackTestCase, unittest
+from marvin.cloudstackTestCase import cloudstackTestCase
+import unittest
from marvin.lib.utils import (validateList,
get_host_credentials,
get_process_status,
diff --git a/test/integration/component/test_multiple_subnets_in_vpc_rvr.py b/test/integration/component/test_multiple_subnets_in_vpc_rvr.py
index f6c0f5242d08..100bf95da9bb 100644
--- a/test/integration/component/test_multiple_subnets_in_vpc_rvr.py
+++ b/test/integration/component/test_multiple_subnets_in_vpc_rvr.py
@@ -21,7 +21,8 @@
from nose.plugins.attrib import attr
from marvin.cloudstackAPI import rebootRouter
-from marvin.cloudstackTestCase import cloudstackTestCase, unittest
+from marvin.cloudstackTestCase import cloudstackTestCase
+import unittest
from marvin.lib.utils import (validateList,
get_host_credentials,
get_process_status,
diff --git a/test/integration/component/test_network_offering.py b/test/integration/component/test_network_offering.py
index 9d35721f16c4..1fb24ca68bd1 100644
--- a/test/integration/component/test_network_offering.py
+++ b/test/integration/component/test_network_offering.py
@@ -785,7 +785,7 @@ def test_03_network_off_CS5332(self):
issystem = "true"
)
status = validateList(vr_sys_off_res)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"Listing of VR system offering failed"
@@ -815,17 +815,17 @@ def test_03_network_off_CS5332(self):
id=self.network_offering.id
)
status = validateList(network_off_res)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"Listing of network offerings failed"
)
- self.assertEquals(
+ self.assertEqual(
len(network_off_res),
1,
"More than one network offerings are created"
)
- self.assertEquals(
+ self.assertEqual(
network_off_res[0].serviceofferingid,
vr_sys_off.id,
"FAIL: Network offering has been created with default system offering"
diff --git a/test/integration/component/test_non_contiguous_vlan.py b/test/integration/component/test_non_contiguous_vlan.py
index 0f3dcb78fb41..3224a3a5946f 100644
--- a/test/integration/component/test_non_contiguous_vlan.py
+++ b/test/integration/component/test_non_contiguous_vlan.py
@@ -176,7 +176,7 @@ def validatePhysicalNetworkVlan(self, physicalNetworkId, vlan):
vlans = xsplit(vlan,[','])
for virtualLan in vlans:
- self.assert_(physicalnetworks[0].vlan.find(virtualLan) != -1, "vlan range %s \
+ self.assertTrue(physicalnetworks[0].vlan.find(virtualLan) != -1, "vlan range %s \
is not present in physical network: %s" % (virtualLan, physicalNetworkId))
return
@@ -193,7 +193,7 @@ def test_01_add_non_contiguous_ranges(self):
vlan1 = self.existingvlan + "," + self.vlan["partial_range"][0]
updatePhysicalNetworkResponse = self.physicalnetwork.update(self.apiClient, id = self.physicalnetworkid, vlan = vlan1)
- self.assert_(updatePhysicalNetworkResponse is not None,
+ self.assertTrue(updatePhysicalNetworkResponse is not None,
msg="couldn't add non contiguous range in the physical network with vlan %s"%vlan1)
self.debug("Verifying the VLAN of the updated physical network: %s, It should match with \
@@ -204,7 +204,7 @@ def test_01_add_non_contiguous_ranges(self):
vlan2 = vlan1 + "," + self.vlan["partial_range"][1]
updatePhysicalNetworkResponse2 = self.physicalnetwork.update(self.apiClient, id = self.physicalnetworkid, vlan = vlan2)
- self.assert_(updatePhysicalNetworkResponse2 is not None,
+ self.assertTrue(updatePhysicalNetworkResponse2 is not None,
msg="couldn't add non contiguous range in the physical network with vlan %s"%vlan2)
self.debug("Verifying the VLAN of the updated physical network: %s, It should match with \
@@ -252,7 +252,7 @@ def test_03_extend_contiguous_range(self):
vlan2 = vlan1 + "," + self.vlan["full_range"]
updatePhysicalNetworkResponse = self.physicalnetwork.update(self.apiClient, id = self.physicalnetworkid, vlan = vlan2)
- self.assert_(updatePhysicalNetworkResponse is not None,
+ self.assertTrue(updatePhysicalNetworkResponse is not None,
msg="couldn't extend the physical network with vlan %s"%vlan2)
extendedvlan = self.existingvlan + "," + self.vlan["full_range"]
@@ -289,7 +289,7 @@ def test_04_remove_unused_range(self):
vlanranges= physicalnetworks[0].vlan
- self.assert_(vlanranges.find(self.vlan["partial_range"][0]) == -1, "vlan range is not removed")
+ self.assertTrue(vlanranges.find(self.vlan["partial_range"][0]) == -1, "vlan range is not removed")
return
diff --git a/test/integration/component/test_overcommit.py b/test/integration/component/test_overcommit.py
index 14b76f5092b4..fc9b26c86eb6 100644
--- a/test/integration/component/test_overcommit.py
+++ b/test/integration/component/test_overcommit.py
@@ -394,7 +394,7 @@ def test_04_zone_capacity_check(self):
"check list cluster response for zone id %s" %
self.zone.id)
k = len(list_cluster)
- for id in xrange(k):
+ for id in range(k):
Configurations.update(self.apiclient,
clusterid=list_cluster[id].id,
name="mem.overprovisioning.factor",
@@ -414,7 +414,7 @@ def test_04_zone_capacity_check(self):
"check list capacity response for zone id %s" %
self.zone.id)
cpu, mem = capacity_parser(capacity)
- for id in xrange(k):
+ for id in range(k):
Configurations.update(self.apiclient,
clusterid=list_cluster[id].id,
name="mem.overprovisioning.factor",
@@ -452,7 +452,7 @@ def test_04_zone_capacity_check(self):
self.assertEqual(mem[2],
mem1[2],
"check mem capacity % used")
- for id in xrange(k):
+ for id in range(k):
Configurations.update(self.apiclient,
clusterid=list_cluster[id].id,
name="mem.overprovisioning.factor",
diff --git a/test/integration/component/test_persistent_networks.py b/test/integration/component/test_persistent_networks.py
index 69ed493fb154..c25ce2dc3506 100644
--- a/test/integration/component/test_persistent_networks.py
+++ b/test/integration/component/test_persistent_networks.py
@@ -44,7 +44,8 @@
from nose.plugins.attrib import attr
from marvin.codes import PASS, FAIL, FAILED
from marvin.sshClient import SshClient
-from marvin.cloudstackTestCase import cloudstackTestCase, unittest
+from marvin.cloudstackTestCase import cloudstackTestCase
+import unittest
from ddt import ddt, data
import time
diff --git a/test/integration/component/test_project_limits.py b/test/integration/component/test_project_limits.py
index ad4e75de0250..955c4dd0861a 100644
--- a/test/integration/component/test_project_limits.py
+++ b/test/integration/component/test_project_limits.py
@@ -18,7 +18,8 @@
"""
#Import Local Modules
from nose.plugins.attrib import attr
-from marvin.cloudstackTestCase import cloudstackTestCase, unittest
+from marvin.cloudstackTestCase import cloudstackTestCase
+import unittest
#from marvin.cloudstackAPI import *
from marvin.lib.utils import (cleanup_resources,
validateList)
diff --git a/test/integration/component/test_project_resources.py b/test/integration/component/test_project_resources.py
index 607c684f8ced..0b7d9a7fdbee 100644
--- a/test/integration/component/test_project_resources.py
+++ b/test/integration/component/test_project_resources.py
@@ -18,7 +18,8 @@
"""
#Import Local Modules
from nose.plugins.attrib import attr
-from marvin.cloudstackTestCase import cloudstackTestCase, unittest
+from marvin.cloudstackTestCase import cloudstackTestCase
+import unittest
from marvin.lib.base import (VirtualMachine,
Account,
Project,
diff --git a/test/integration/component/test_project_usage.py b/test/integration/component/test_project_usage.py
index 829cbc7e09a5..10028ed92a3a 100644
--- a/test/integration/component/test_project_usage.py
+++ b/test/integration/component/test_project_usage.py
@@ -18,7 +18,8 @@
"""
#Import Local Modules
from nose.plugins.attrib import attr
-from marvin.cloudstackTestCase import cloudstackTestCase, unittest
+from marvin.cloudstackTestCase import cloudstackTestCase
+import unittest
from marvin.cloudstackAPI import deleteVolume
from marvin.lib.utils import (cleanup_resources, validateList)
from marvin.lib.base import (Project,
@@ -2026,4 +2027,4 @@ def test_01_vmsnapshot_usage(self):
1,
"Check VM.SNAPSHOT.DELETE in events table"
)
- return
\ No newline at end of file
+ return
diff --git a/test/integration/component/test_protocol_number_security_group.py b/test/integration/component/test_protocol_number_security_group.py
index 60296753845a..69c07c2263cf 100644
--- a/test/integration/component/test_protocol_number_security_group.py
+++ b/test/integration/component/test_protocol_number_security_group.py
@@ -21,7 +21,8 @@
# Import Local Modules
from nose.plugins.attrib import attr
-from marvin.cloudstackTestCase import cloudstackTestCase, unittest
+from marvin.cloudstackTestCase import cloudstackTestCase
+import unittest
from marvin.cloudstackAPI import authorizeSecurityGroupIngress, revokeSecurityGroupIngress, authorizeSecurityGroupEgress, revokeSecurityGroupEgress
from marvin.sshClient import SshClient
from marvin.lib.utils import (validateList,
diff --git a/test/integration/component/test_ps_domain_limits.py b/test/integration/component/test_ps_domain_limits.py
index 3c4c4d32daf2..9740ab9557db 100644
--- a/test/integration/component/test_ps_domain_limits.py
+++ b/test/integration/component/test_ps_domain_limits.py
@@ -25,7 +25,8 @@
"""
# Import Local Modules
from nose.plugins.attrib import attr
-from marvin.cloudstackTestCase import cloudstackTestCase, unittest
+from marvin.cloudstackTestCase import cloudstackTestCase
+import unittest
from marvin.lib.base import (Account,
ServiceOffering,
VirtualMachine,
@@ -366,7 +367,7 @@ def test_02_multiple_domains_primary_storage_limits(self):
templatesize = (self.template.size / (1024 ** 3))
- for domain, admin in users.items():
+ for domain, admin in list(users.items()):
self.account = admin
self.domain = domain
@@ -454,7 +455,7 @@ def test_03_multiple_domains_multiple_volumes(self):
templatesize = (self.template.size / (1024 ** 3))
- for domain, admin in users.items():
+ for domain, admin in list(users.items()):
self.account = admin
self.domain = domain
@@ -562,7 +563,7 @@ def test_04_create_template_snapshot(self):
result[1])
users = result[2]
- for domain, admin in users.items():
+ for domain, admin in list(users.items()):
self.account = admin
self.domain = domain
@@ -724,7 +725,7 @@ def test_06_destroy_recover_vm(self):
self.assertEqual(result[0], PASS, result[1])
users = result[2]
- for domain, admin in users.items():
+ for domain, admin in list(users.items()):
self.account = admin
self.domain = domain
try:
diff --git a/test/integration/component/test_ps_limits.py b/test/integration/component/test_ps_limits.py
index 983f72aa7aa9..0211e909bb0f 100644
--- a/test/integration/component/test_ps_limits.py
+++ b/test/integration/component/test_ps_limits.py
@@ -25,7 +25,8 @@
"""
# Import Local Modules
from nose.plugins.attrib import attr
-from marvin.cloudstackTestCase import cloudstackTestCase, unittest
+from marvin.cloudstackTestCase import cloudstackTestCase
+import unittest
from marvin.lib.base import (
Account,
ServiceOffering,
diff --git a/test/integration/component/test_ps_max_limits.py b/test/integration/component/test_ps_max_limits.py
index 5fb84228a892..d8d8992f70ae 100644
--- a/test/integration/component/test_ps_max_limits.py
+++ b/test/integration/component/test_ps_max_limits.py
@@ -25,7 +25,8 @@
"""
# Import Local Modules
from nose.plugins.attrib import attr
-from marvin.cloudstackTestCase import cloudstackTestCase, unittest
+from marvin.cloudstackTestCase import cloudstackTestCase
+import unittest
from marvin.lib.base import (Account,
ServiceOffering,
VirtualMachine,
diff --git a/test/integration/component/test_ps_project_limits.py b/test/integration/component/test_ps_project_limits.py
index c79e3b881fef..d549467d55c9 100644
--- a/test/integration/component/test_ps_project_limits.py
+++ b/test/integration/component/test_ps_project_limits.py
@@ -25,7 +25,8 @@
"""
# Import Local Modules
from nose.plugins.attrib import attr
-from marvin.cloudstackTestCase import cloudstackTestCase, unittest
+from marvin.cloudstackTestCase import cloudstackTestCase
+import unittest
from marvin.lib.base import (Account,
ServiceOffering,
VirtualMachine,
diff --git a/test/integration/component/test_ps_resize_volume.py b/test/integration/component/test_ps_resize_volume.py
index c396016ad0a0..f691dd9fd674 100644
--- a/test/integration/component/test_ps_resize_volume.py
+++ b/test/integration/component/test_ps_resize_volume.py
@@ -28,7 +28,8 @@
"""
# Import Local Modules
from nose.plugins.attrib import attr
-from marvin.cloudstackTestCase import cloudstackTestCase, unittest
+from marvin.cloudstackTestCase import cloudstackTestCase
+import unittest
from marvin.lib.base import (Account,
ServiceOffering,
VirtualMachine,
diff --git a/test/integration/component/test_reset_ssh_keypair.py b/test/integration/component/test_reset_ssh_keypair.py
index db7e9b82d983..23f19743fc68 100644
--- a/test/integration/component/test_reset_ssh_keypair.py
+++ b/test/integration/component/test_reset_ssh_keypair.py
@@ -32,7 +32,8 @@
from marvin.lib.utils import (cleanup_resources,
random_gen,
validateList)
-from marvin.cloudstackTestCase import cloudstackTestCase, unittest
+from marvin.cloudstackTestCase import cloudstackTestCase
+import unittest
from marvin.codes import PASS, RUNNING
#Import System modules
diff --git a/test/integration/component/test_rootvolume_resize.py b/test/integration/component/test_rootvolume_resize.py
index 94fc53bf1bb6..f5bd47d11465 100644
--- a/test/integration/component/test_rootvolume_resize.py
+++ b/test/integration/component/test_rootvolume_resize.py
@@ -24,7 +24,8 @@
"""
# Import Local Modules
from nose.plugins.attrib import attr
-from marvin.cloudstackTestCase import cloudstackTestCase, unittest
+from marvin.cloudstackTestCase import cloudstackTestCase
+import unittest
from marvin.lib.base import (Account,
ServiceOffering,
VirtualMachine,
@@ -641,7 +642,7 @@ def test_03_vmsnapshot__on_resized_rootvolume_vm(self):
list(self.apiclient,
vmsnapshotid=virtualmachine_snapshot.id)
status = validateList(virtulmachine_snapshot_list)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"Listing of configuration failed")
@@ -1030,7 +1031,7 @@ def test_7_usage_events_after_rootvolume_resized_(self):
self.assertNotEqual(res[2], INVALID_INPUT, "Check DB Query result set")
qresult = int(qresultsize[0][0])
self.debug("Query result: %s" % qresult)
- self.assertEquals(
+ self.assertEqual(
qresult,
(newsize * 1024 * 1024 * 1024),
"Usage event not logged properly with right volume"
@@ -1140,4 +1141,4 @@ def test_08_increase_volume_size_within_account_limit(self):
" storage capacity after root "
"volume resize : %s" % e)
- return
\ No newline at end of file
+ return
diff --git a/test/integration/component/test_secsr_mount.py b/test/integration/component/test_secsr_mount.py
index 71b45ccc2748..6022b88bf0d8 100644
--- a/test/integration/component/test_secsr_mount.py
+++ b/test/integration/component/test_secsr_mount.py
@@ -14,7 +14,7 @@
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
-from __builtin__ import False
+from builtins import False
""" Tests for Secondary Storage with Local Storage
"""
@@ -93,7 +93,7 @@ def isOnlyLocalStorageAvailable(self):
"Check if listStoragePools returns a valid response"
)
for storage_pool in storage_pools:
- if storage_pool.type == u'NetworkFilesystem':
+ if storage_pool.type == 'NetworkFilesystem':
return False
return True
diff --git a/test/integration/component/test_shared_networks.py b/test/integration/component/test_shared_networks.py
index 93d266a52a0d..725ee9162aa8 100644
--- a/test/integration/component/test_shared_networks.py
+++ b/test/integration/component/test_shared_networks.py
@@ -18,7 +18,8 @@
""" P1 tests for shared networks
"""
from nose.plugins.attrib import attr
-from marvin.cloudstackTestCase import cloudstackTestCase, unittest
+from marvin.cloudstackTestCase import cloudstackTestCase
+import unittest
from marvin.cloudstackAPI import rebootRouter, stopRouter, startRouter
from marvin.lib.base import (Account,
Network,
@@ -796,10 +797,10 @@ def test_createSharedNetwork_All(self):
ip_range = list(
netaddr.iter_iprange(
- unicode(
- self.testdata["shared_network"]["startip"]), unicode(
+ str(
+ self.testdata["shared_network"]["startip"]), str(
self.testdata["shared_network"]["endip"])))
- if netaddr.IPAddress(unicode(vms[0].nic[0].ipaddress)) not in ip_range:
+ if netaddr.IPAddress(str(vms[0].nic[0].ipaddress)) not in ip_range:
self.fail(
"Virtual machine ip should be from the ip range assigned to\
network created.")
@@ -834,10 +835,10 @@ def test_createSharedNetwork_All(self):
ip_range = list(
netaddr.iter_iprange(
- unicode(
- self.testdata["shared_network"]["startip"]), unicode(
+ str(
+ self.testdata["shared_network"]["startip"]), str(
self.testdata["shared_network"]["endip"])))
- if netaddr.IPAddress(unicode(vms[0].nic[0].ipaddress)) not in ip_range:
+ if netaddr.IPAddress(str(vms[0].nic[0].ipaddress)) not in ip_range:
self.fail(
"Virtual machine ip should be from the ip range assigned to\
network created.")
@@ -1107,10 +1108,10 @@ def test_createSharedNetwork_accountSpecific(self):
ip_range = list(
netaddr.iter_iprange(
- unicode(
- self.testdata["shared_network"]["startip"]), unicode(
+ str(
+ self.testdata["shared_network"]["startip"]), str(
self.testdata["shared_network"]["endip"])))
- if netaddr.IPAddress(unicode(vms[0].nic[0].ipaddress)) not in ip_range:
+ if netaddr.IPAddress(str(vms[0].nic[0].ipaddress)) not in ip_range:
self.fail(
"Virtual machine ip should be from the ip range assigned\
to network created.")
@@ -1449,10 +1450,10 @@ def test_createSharedNetwork_domainSpecific(self):
ip_range = list(
netaddr.iter_iprange(
- unicode(
- self.testdata["shared_network"]["startip"]), unicode(
+ str(
+ self.testdata["shared_network"]["startip"]), str(
self.testdata["shared_network"]["endip"])))
- if netaddr.IPAddress(unicode(vms[0].nic[0].ipaddress)) not in ip_range:
+ if netaddr.IPAddress(str(vms[0].nic[0].ipaddress)) not in ip_range:
self.fail(
"Virtual machine ip should be from the ip range\
assigned to network created.")
@@ -1484,10 +1485,10 @@ def test_createSharedNetwork_domainSpecific(self):
ip_range = list(
netaddr.iter_iprange(
- unicode(
- self.testdata["shared_network"]["startip"]), unicode(
+ str(
+ self.testdata["shared_network"]["startip"]), str(
self.testdata["shared_network"]["endip"])))
- if netaddr.IPAddress(unicode(vms[0].nic[0].ipaddress)) not in ip_range:
+ if netaddr.IPAddress(str(vms[0].nic[0].ipaddress)) not in ip_range:
self.fail(
"Virtual machine ip should be from the ip range assigne\
to network created.")
@@ -1777,10 +1778,10 @@ def test_createSharedNetwork_projectSpecific(self):
ip_range = list(
netaddr.iter_iprange(
- unicode(
- self.testdata["shared_network"]["startip"]), unicode(
+ str(
+ self.testdata["shared_network"]["startip"]), str(
self.testdata["shared_network"]["endip"])))
- if netaddr.IPAddress(unicode(vms[0].nic[0].ipaddress)) not in ip_range:
+ if netaddr.IPAddress(str(vms[0].nic[0].ipaddress)) not in ip_range:
self.fail(
"Virtual machine ip should be from the ip range assigned\
to network created.")
@@ -3144,7 +3145,7 @@ def test_escalation_ES1621(self):
id=self.shared_network_offering.id
)
status = validateList(list_network_offerings_response)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"listNetworkOfferings returned invalid object in response."
@@ -3170,7 +3171,7 @@ def test_escalation_ES1621(self):
id=self.shared_network_offering.id
)
status = validateList(list_network_offerings_response)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"listNetworkOfferings returned invalid object in\
@@ -3200,7 +3201,7 @@ def test_escalation_ES1621(self):
id=self.network.id
)
status = validateList(list_accounts_response)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"listNetworks returned invalid object in response."
@@ -3246,7 +3247,7 @@ def test_escalation_ES1621(self):
id=self.network2.id
)
status = validateList(list_networks_response)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"listNetworks returned invalid object in response after\
diff --git a/test/integration/component/test_simultaneous_volume_attach.py b/test/integration/component/test_simultaneous_volume_attach.py
index 7ccde9cc7852..aee5cf600267 100644
--- a/test/integration/component/test_simultaneous_volume_attach.py
+++ b/test/integration/component/test_simultaneous_volume_attach.py
@@ -17,7 +17,8 @@
#Import Local Modules
from marvin.cloudstackAPI import *
-from marvin.cloudstackTestCase import cloudstackTestCase, unittest
+from marvin.cloudstackTestCase import cloudstackTestCase
+import unittest
from marvin.lib.utils import (cleanup_resources,
validateList)
from marvin.lib.base import (ServiceOffering,
@@ -252,4 +253,4 @@ def test_attach_multiple_volumes(self):
"All 4 data disks are not attached to VM Successfully"
)
- return
\ No newline at end of file
+ return
diff --git a/test/integration/component/test_snapshot_gc.py b/test/integration/component/test_snapshot_gc.py
index 21a23e5ca1ee..1e08c046e076 100644
--- a/test/integration/component/test_snapshot_gc.py
+++ b/test/integration/component/test_snapshot_gc.py
@@ -16,7 +16,8 @@
# under the License.
from nose.plugins.attrib import attr
-from marvin.cloudstackTestCase import cloudstackTestCase, unittest
+from marvin.cloudstackTestCase import cloudstackTestCase
+import unittest
#from marvin.cloudstackAPI import *
from marvin.lib.utils import (
is_snapshot_on_nfs,
@@ -190,7 +191,7 @@ def setUpClass(cls):
# Create a snapshot from the ROOTDISK
cls.snapshot = Snapshot.create(cls.api_client, volume.id)
- except Exception, e:
+ except Exception as e:
cls.tearDownClass()
unittest.SkipTest("setupClass fails for %s" % cls.__name__)
raise e
diff --git a/test/integration/component/test_snapshot_limits.py b/test/integration/component/test_snapshot_limits.py
index 21e15da236af..eb036605e916 100644
--- a/test/integration/component/test_snapshot_limits.py
+++ b/test/integration/component/test_snapshot_limits.py
@@ -16,7 +16,8 @@
# under the License.
from nose.plugins.attrib import attr
-from marvin.cloudstackTestCase import cloudstackTestCase, unittest
+from marvin.cloudstackTestCase import cloudstackTestCase
+import unittest
from marvin.lib.utils import cleanup_resources
from marvin.lib.base import (Account,
VirtualMachine,
@@ -179,7 +180,7 @@ def setUpClass(cls):
serviceofferingid=cls.service_offering.id
)
cls._cleanup.append(cls.virtual_machine)
- except Exception, e:
+ except Exception as e:
cls.tearDownClass()
unittest.SkipTest("setupClass fails for %s" % cls.__name__)
raise e
diff --git a/test/integration/component/test_ss_domain_limits.py b/test/integration/component/test_ss_domain_limits.py
index 0d9138ad6590..ea89f9d3f06f 100644
--- a/test/integration/component/test_ss_domain_limits.py
+++ b/test/integration/component/test_ss_domain_limits.py
@@ -280,7 +280,7 @@ def test_02_multiple_domains_secondary_storage_counts(self):
self.assertEqual(result[0], PASS, result[1])
users = result[2]
- for domain, admin in users.items():
+ for domain, admin in list(users.items()):
self.account = admin
self.domain = domain
@@ -351,7 +351,7 @@ def test_03_copy_template(self):
self.assertEqual(result[0], PASS, result[1])
users = result[2]
- for domain, admin in users.items():
+ for domain, admin in list(users.items()):
self.account = admin
self.domain = domain
diff --git a/test/integration/component/test_ss_limits.py b/test/integration/component/test_ss_limits.py
index bd61398aac24..3d35d4337aae 100644
--- a/test/integration/component/test_ss_limits.py
+++ b/test/integration/component/test_ss_limits.py
@@ -25,7 +25,8 @@
"""
# Import Local Modules
from nose.plugins.attrib import attr
-from marvin.cloudstackTestCase import cloudstackTestCase, unittest
+from marvin.cloudstackTestCase import cloudstackTestCase
+import unittest
from marvin.lib.base import (Account,
ServiceOffering,
VirtualMachine,
diff --git a/test/integration/component/test_ss_project_limits.py b/test/integration/component/test_ss_project_limits.py
index ca58dbd7dcba..289c4c1778a5 100644
--- a/test/integration/component/test_ss_project_limits.py
+++ b/test/integration/component/test_ss_project_limits.py
@@ -25,7 +25,8 @@
"""
# Import Local Modules
from nose.plugins.attrib import attr
-from marvin.cloudstackTestCase import cloudstackTestCase, unittest
+from marvin.cloudstackTestCase import cloudstackTestCase
+import unittest
from marvin.lib.base import (Account,
ServiceOffering,
VirtualMachine,
diff --git a/test/integration/component/test_stopped_vm.py b/test/integration/component/test_stopped_vm.py
index 589c71b4cbb8..c1b5da366b32 100644
--- a/test/integration/component/test_stopped_vm.py
+++ b/test/integration/component/test_stopped_vm.py
@@ -343,8 +343,8 @@ def test_05_deploy_startvm_false_change_so(self):
listedvm = VirtualMachine.list(
self.apiclient,
id=self.virtual_machine.id)
- self.assert_(isinstance(listedvm, list))
- self.assert_(len(listedvm) > 0)
+ self.assertTrue(isinstance(listedvm, list))
+ self.assertTrue(len(listedvm) > 0)
self.assertEqual(
listedvm[0].serviceofferingid,
medium_service_off.id,
diff --git a/test/integration/component/test_storage_motion.py b/test/integration/component/test_storage_motion.py
index 6450d0606495..7987dee3a173 100644
--- a/test/integration/component/test_storage_motion.py
+++ b/test/integration/component/test_storage_motion.py
@@ -268,8 +268,8 @@ def test_02_migrate_volume(self):
if not pools:
self.skipTest("No suitable storage pools found for volume migration. Skipping")
- self.assert_(isinstance(pools, list), "invalid pool response from listStoragePoolsForMigration: %s" %pools)
- self.assert_(len(pools) > 0, "no valid storage pools found for migration")
+ self.assertTrue(isinstance(pools, list), "invalid pool response from listStoragePoolsForMigration: %s" %pools)
+ self.assertTrue(len(pools) > 0, "no valid storage pools found for migration")
pool = pools[0]
self.debug("Migrating Volume-ID: %s to Pool: %s" % (
diff --git a/test/integration/component/test_tags.py b/test/integration/component/test_tags.py
index dcf82c191c51..d545866b4aed 100644
--- a/test/integration/component/test_tags.py
+++ b/test/integration/component/test_tags.py
@@ -787,7 +787,7 @@ def test_04_vpn_tag(self):
)
except Exception as e:
- print e
+ print(e)
vpns = Vpn.list(
self.apiclient,
diff --git a/test/integration/component/test_template_from_snapshot_with_template_details.py b/test/integration/component/test_template_from_snapshot_with_template_details.py
index 4e20261ea9b2..6b03860319ad 100644
--- a/test/integration/component/test_template_from_snapshot_with_template_details.py
+++ b/test/integration/component/test_template_from_snapshot_with_template_details.py
@@ -18,7 +18,8 @@
"""
# Import Local Modules
from nose.plugins.attrib import attr
-from marvin.cloudstackTestCase import cloudstackTestCase, unittest
+from marvin.cloudstackTestCase import cloudstackTestCase
+import unittest
from marvin.cloudstackAPI import listZones
from marvin.lib.utils import (cleanup_resources)
from marvin.lib.base import (Account,
diff --git a/test/integration/component/test_templates.py b/test/integration/component/test_templates.py
index 496c1d605af0..f5e2d4625ce1 100644
--- a/test/integration/component/test_templates.py
+++ b/test/integration/component/test_templates.py
@@ -18,7 +18,8 @@
"""
# Import Local Modules
from nose.plugins.attrib import attr
-from marvin.cloudstackTestCase import cloudstackTestCase, unittest
+from marvin.cloudstackTestCase import cloudstackTestCase
+import unittest
from marvin.cloudstackAPI import listZones
from marvin.lib.utils import (cleanup_resources)
from marvin.lib.base import (Account,
diff --git a/test/integration/component/test_updateResourceCount.py b/test/integration/component/test_updateResourceCount.py
index c9bd6e6f183a..cc0246818437 100644
--- a/test/integration/component/test_updateResourceCount.py
+++ b/test/integration/component/test_updateResourceCount.py
@@ -232,4 +232,4 @@ def test_01_updateResourceCount(self):
1024,
"The memory amount does not seem to be right."
)
- return
\ No newline at end of file
+ return
diff --git a/test/integration/component/test_vm_passwdenabled.py b/test/integration/component/test_vm_passwdenabled.py
index d340031935c3..20dcbd73d5f5 100644
--- a/test/integration/component/test_vm_passwdenabled.py
+++ b/test/integration/component/test_vm_passwdenabled.py
@@ -14,7 +14,8 @@
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
-from marvin.cloudstackTestCase import cloudstackTestCase, unittest
+from marvin.cloudstackTestCase import cloudstackTestCase
+import unittest
from marvin.lib.utils import cleanup_resources
from marvin.lib.base import (Account,
ServiceOffering,
diff --git a/test/integration/component/test_vmware_drs.py b/test/integration/component/test_vmware_drs.py
index 5d701e893404..9ec84ef46396 100644
--- a/test/integration/component/test_vmware_drs.py
+++ b/test/integration/component/test_vmware_drs.py
@@ -21,7 +21,8 @@
import marvin
from nose.plugins.attrib import attr
-from marvin.cloudstackTestCase import cloudstackTestCase, unittest
+from marvin.cloudstackTestCase import cloudstackTestCase
+import unittest
from marvin.lib.base import (Account,
AffinityGroup,
diff --git a/test/integration/component/test_volumes.py b/test/integration/component/test_volumes.py
index 50341ac7c3c9..9662f6aa6959 100644
--- a/test/integration/component/test_volumes.py
+++ b/test/integration/component/test_volumes.py
@@ -1231,7 +1231,7 @@ def test_create_volume_under_domain(self):
zoneid=self.zone.id,
account=domuser.name,
domainid=dom.id,
- diskofferingid=filter(lambda x: not x.iscustomized, diskoffering)[0].id
+ diskofferingid=[x for x in diskoffering if not x.iscustomized][0].id
)
self.assertTrue(
vol is not None, "volume creation fails in domain %s as user %s" %
diff --git a/test/integration/component/test_vpc_network.py b/test/integration/component/test_vpc_network.py
index 1dbccf8fc456..4f31738d0b46 100644
--- a/test/integration/component/test_vpc_network.py
+++ b/test/integration/component/test_vpc_network.py
@@ -19,7 +19,8 @@
"""
# Import Local Modules
from nose.plugins.attrib import attr
-from marvin.cloudstackTestCase import cloudstackTestCase, unittest
+from marvin.cloudstackTestCase import cloudstackTestCase
+import unittest
from marvin.cloudstackAPI import startVirtualMachine, stopVirtualMachine
from marvin.lib.utils import cleanup_resources, validateList
from marvin.lib.base import (VirtualMachine,
diff --git a/test/integration/component/test_vpc_network_internal_lbrules.py b/test/integration/component/test_vpc_network_internal_lbrules.py
index 9523083e13ba..ea2a00f30766 100644
--- a/test/integration/component/test_vpc_network_internal_lbrules.py
+++ b/test/integration/component/test_vpc_network_internal_lbrules.py
@@ -83,7 +83,7 @@ def tearDownClass(cls):
# Cleanup resources used
cleanup_resources(cls.api_client, cls._cleanup)
except Exception as e:
- print ("Warning: Exception during cleanup : %s" % e)
+ print(("Warning: Exception during cleanup : %s" % e))
return
def setUp(self):
diff --git a/test/integration/component/test_vpc_network_lbrules.py b/test/integration/component/test_vpc_network_lbrules.py
index 88da61d47d37..9d3ec51bd036 100644
--- a/test/integration/component/test_vpc_network_lbrules.py
+++ b/test/integration/component/test_vpc_network_lbrules.py
@@ -19,7 +19,8 @@
"""
#Import Local Modules
from nose.plugins.attrib import attr
-from marvin.cloudstackTestCase import cloudstackTestCase, unittest
+from marvin.cloudstackTestCase import cloudstackTestCase
+import unittest
from marvin.lib.base import (stopRouter,
startRouter,
Account,
@@ -209,7 +210,7 @@ def tearDownClass(cls):
#Cleanup resources used
cleanup_resources(cls.api_client, cls._cleanup)
except Exception as e:
- print ("Warning: Exception during cleanup : %s" % e)
+ print(("Warning: Exception during cleanup : %s" % e))
#raise Exception("Warning: Exception during cleanup : %s" % e)
return
@@ -330,15 +331,15 @@ def check_ssh_into_vm(self, vm, public_ip, testnegative=False):
self.debug("Failed to SSH into VM - %s" % (public_ip.ipaddress.ipaddress))
def check_wget_from_vm(self, vm, public_ip, testnegative=False):
- import urllib
+ import urllib.request, urllib.parse, urllib.error
self.debug("Checking if we can wget from a VM=%s http server on public_ip=%s" % (vm.name, public_ip.ipaddress.ipaddress))
try:
- urllib.urlretrieve("http://%s/test.html" % public_ip.ipaddress.ipaddress, filename="test.html")
+ urllib.request.urlretrieve("http://%s/test.html" % public_ip.ipaddress.ipaddress, filename="test.html")
if not testnegative:
self.debug("Successful to wget from VM=%s http server on public_ip=%s" % (vm.name, public_ip.ipaddress.ipaddress))
else:
self.fail("Successful to wget from VM=%s http server on public_ip=%s" % (vm.name, public_ip.ipaddress.ipaddress))
- except Exception, e:
+ except Exception as e:
if not testnegative:
self.fail("Failed to wget from VM=%s http server on public_ip=%s because of %s" % (vm.name, public_ip.ipaddress.ipaddress, e))
else:
@@ -540,7 +541,7 @@ def test_01_VPC_LBRulesListing(self):
id=lb_rule1.id,
listall=True
)
- self.failIfEqual(lb_rules,
+ self.assertNotEqual(lb_rules,
None,
"Failed to list the LB Rule"
)
@@ -548,7 +549,7 @@ def test_01_VPC_LBRulesListing(self):
networkid=network_1.id,
listall=True
)
- self.failIfEqual(vms,
+ self.assertNotEqual(vms,
None,
"Failed to list the VMs in network=%s" % network_1.name
)
diff --git a/test/integration/component/test_vpc_network_pfrules.py b/test/integration/component/test_vpc_network_pfrules.py
index e5fca1a1282a..a4ade4ce3d8d 100644
--- a/test/integration/component/test_vpc_network_pfrules.py
+++ b/test/integration/component/test_vpc_network_pfrules.py
@@ -329,14 +329,14 @@ def check_ssh_into_vm(self, vm, public_ip, testnegative=False):
self.debug("Failed to SSH into VM - %s" % (public_ip.ipaddress.ipaddress))
def check_wget_from_vm(self, vm, public_ip, network=None, testnegative=False, isVmAccessible=True):
- import urllib
+ import urllib.request, urllib.parse, urllib.error
self.debug("Checking if we can wget from a VM=%s http server on public_ip=%s" % (vm.name, public_ip.ipaddress.ipaddress))
try:
if not isVmAccessible:
self.create_natrule(vm, public_ip, network)
self.setup_webserver(vm)
- urllib.urlretrieve("http://%s/test.html" % public_ip.ipaddress.ipaddress, filename="test.html")
+ urllib.request.urlretrieve("http://%s/test.html" % public_ip.ipaddress.ipaddress, filename="test.html")
if not testnegative:
self.debug("Successesfull to wget from VM=%s http server on public_ip=%s" % (vm.name, public_ip.ipaddress.ipaddress))
else:
@@ -465,7 +465,7 @@ def create_network(self, net_offerring, gateway='10.1.1.1',vpc=None):
)
self.debug("Created network with ID: %s" % obj_network.id)
return obj_network
- except Exception, e:
+ except Exception as e:
self.fail('Unable to create a Network with offering=%s because of %s ' % (net_offerring, e))
def deployvm_in_network(self, network, host_id=None):
diff --git a/test/integration/component/test_vpc_network_staticnatrule.py b/test/integration/component/test_vpc_network_staticnatrule.py
index d75044bae28e..c5f39b344995 100644
--- a/test/integration/component/test_vpc_network_staticnatrule.py
+++ b/test/integration/component/test_vpc_network_staticnatrule.py
@@ -18,7 +18,8 @@
""" Component tests for VPC network functionality - Port Forwarding Rules.
"""
from nose.plugins.attrib import attr
-from marvin.cloudstackTestCase import cloudstackTestCase, unittest
+from marvin.cloudstackTestCase import cloudstackTestCase
+import unittest
from marvin.lib.base import (Account,
VpcOffering,
VPC,
@@ -210,7 +211,7 @@ def tearDownClass(cls):
#Cleanup resources used
cleanup_resources(cls.api_client, cls._cleanup)
except Exception as e:
- print("Warning: Exception during cleanup : %s" % e)
+ print(("Warning: Exception during cleanup : %s" % e))
#raise Exception("Warning: Exception during cleanup : %s" % e)
return
@@ -330,10 +331,10 @@ def check_ssh_into_vm(self, vm, public_ip, testnegative=False):
self.debug("Failed to SSH into VM - %s" % (public_ip.ipaddress.ipaddress))
def check_wget_from_vm(self, vm, public_ip, testnegative=False):
- import urllib
+ import urllib.request, urllib.parse, urllib.error
self.debug("Checking if we can wget from a VM=%s http server on public_ip=%s" % (vm.name, public_ip.ipaddress.ipaddress))
try:
- urllib.urlretrieve("http://%s/test.html" % public_ip.ipaddress.ipaddress, filename="test.html")
+ urllib.request.urlretrieve("http://%s/test.html" % public_ip.ipaddress.ipaddress, filename="test.html")
if not testnegative:
self.debug("Successful to wget from VM=%s http server on public_ip=%s" % (vm.name, public_ip.ipaddress.ipaddress))
else:
diff --git a/test/integration/component/test_vpc_vm_life_cycle.py b/test/integration/component/test_vpc_vm_life_cycle.py
index ae8ee2b5fbd8..bdc1c9f8f7a2 100644
--- a/test/integration/component/test_vpc_vm_life_cycle.py
+++ b/test/integration/component/test_vpc_vm_life_cycle.py
@@ -19,7 +19,8 @@
"""
#Import Local Modules
from nose.plugins.attrib import attr
-from marvin.cloudstackTestCase import cloudstackTestCase, unittest
+from marvin.cloudstackTestCase import cloudstackTestCase
+import unittest
from marvin.lib.utils import cleanup_resources, validateList
from marvin.lib.base import (VirtualMachine,
NATRule,
diff --git a/test/integration/component/test_vpc_vms_deployment.py b/test/integration/component/test_vpc_vms_deployment.py
index f8aa556fea21..66d3e0c5837f 100644
--- a/test/integration/component/test_vpc_vms_deployment.py
+++ b/test/integration/component/test_vpc_vms_deployment.py
@@ -19,7 +19,8 @@
"""
#Import Local Modules
from nose.plugins.attrib import attr
-from marvin.cloudstackTestCase import cloudstackTestCase, unittest
+from marvin.cloudstackTestCase import cloudstackTestCase
+import unittest
from marvin.lib.base import (VirtualMachine,
NetworkOffering,
VpcOffering,
@@ -343,7 +344,7 @@ def deployVM_and_verify_ssh_access(self, network, ip):
id=vm.id,
)
status = validateList(vm_response)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"vm list api returned invalid response after vm {} deployment".format(vm)
diff --git a/test/integration/plugins/datera/TestVolumes.py b/test/integration/plugins/datera/TestVolumes.py
index 2dc9ebeb8363..15c326ba4e62 100644
--- a/test/integration/plugins/datera/TestVolumes.py
+++ b/test/integration/plugins/datera/TestVolumes.py
@@ -278,7 +278,7 @@ def update(self, overrideFileName):
def _update(self, d, u):
- for k, v in u.iteritems():
+ for k, v in u.items():
if isinstance(v, collections.Mapping):
r = self.update(d.get(k, {}), v)
d[k] = r
@@ -497,7 +497,7 @@ def _get_db_id(self, table, db_obj):
@classmethod
def _purge_datera_volumes(cls):
logger.warn("Deleting all volumes")
- for ai in cls.dt_client.app_instances.get().values():
+ for ai in list(cls.dt_client.app_instances.get().values()):
logger.warn(ai)
if 'CS-T' in ai['name']:
ai.set(admin_state="offline")
@@ -989,7 +989,7 @@ def _check_and_get_dt_volume(self, dt_volume_name, should_exist=True):
dt_volume = None
dt_volumes = self._get_dt_volumes()
- for volume in dt_volumes.values():
+ for volume in list(dt_volumes.values()):
if volume['name'] == dt_volume_name:
dt_volume = volume
break
diff --git a/test/integration/plugins/ldap/ldap_test_data.py b/test/integration/plugins/ldap/ldap_test_data.py
index bfb89d58ae11..15dec9e24190 100644
--- a/test/integration/plugins/ldap/ldap_test_data.py
+++ b/test/integration/plugins/ldap/ldap_test_data.py
@@ -186,4 +186,4 @@ def __init__(self):
LdapTestData.group : LdapTestData.seniors
}
],
- }
\ No newline at end of file
+ }
diff --git a/test/integration/plugins/ldap/test_ldap.py b/test/integration/plugins/ldap/test_ldap.py
index b017957b9360..a8402014e7ee 100644
--- a/test/integration/plugins/ldap/test_ldap.py
+++ b/test/integration/plugins/ldap/test_ldap.py
@@ -466,7 +466,7 @@ def set_ldap_settings_on_domain(cls, domainid):
cmd.value = cls.testdata.testdata[LdapTestData.configuration][LdapTestData.principal]
response = cls.apiclient.updateConfiguration(cmd)
cls.logger.debug("set the id: %s" % response)
- if cls.testdata.testdata[LdapTestData.configuration].has_key(LdapTestData.groupPrinciple) :
+ if LdapTestData.groupPrinciple in cls.testdata.testdata[LdapTestData.configuration] :
cmd.name = LdapTestData.groupPrinciple
cmd.value = cls.testdata.testdata[LdapTestData.configuration][LdapTestData.groupPrinciple]
response = cls.apiclient.updateConfiguration(cmd)
diff --git a/test/integration/plugins/solidfire/TestAddRemoveHosts.py b/test/integration/plugins/solidfire/TestAddRemoveHosts.py
index 1dd29bbcf1c0..858d8e128eab 100644
--- a/test/integration/plugins/solidfire/TestAddRemoveHosts.py
+++ b/test/integration/plugins/solidfire/TestAddRemoveHosts.py
@@ -583,7 +583,7 @@ def _get_host_vag(self, host_iqn, vags):
self.assertTrue(host_iqn, "'host_iqn' should not be 'None'.")
self.assertTrue(vags, "'vags' should not be 'None'.")
- self.assertTrue(isinstance(host_iqn, basestring), "'host_iqn' should be a 'string'.")
+ self.assertTrue(isinstance(host_iqn, str), "'host_iqn' should be a 'string'.")
self.assertTrue(isinstance(vags, list), "'vags' should be a 'list'.")
for vag in vags:
@@ -848,7 +848,7 @@ def _get_root_volume(self, vm):
if volume.type.upper() == "ROOT":
return volume
- self.assert_(False, "Unable to locate the ROOT volume of the VM with the following ID: " + str(vm.id))
+ self.assertTrue(False, "Unable to locate the ROOT volume of the VM with the following ID: " + str(vm.id))
def _get_iqn_2(self, primary_storage):
sql_query = "Select path From storage_pool Where uuid = '" + str(primary_storage.id) + "'"
diff --git a/test/integration/plugins/solidfire/TestManagedSystemVMs.py b/test/integration/plugins/solidfire/TestManagedSystemVMs.py
index 5e9884d406aa..c3807e07a537 100644
--- a/test/integration/plugins/solidfire/TestManagedSystemVMs.py
+++ b/test/integration/plugins/solidfire/TestManagedSystemVMs.py
@@ -398,7 +398,7 @@ def test_02_failure_to_create_service_offering_with_customized_iops(self):
except:
return
- self.assert_(False, "The service offering was created, but should not have been.")
+ self.assertTrue(False, "The service offering was created, but should not have been.")
def _prepare_to_use_managed_storage_for_system_vms(self):
self._update_system_vm_unique_name(TestManagedSystemVMs._secondary_storage_unique_name, TestManagedSystemVMs._secondary_storage_temp_unique_name)
diff --git a/test/integration/plugins/solidfire/TestUploadDownload.py b/test/integration/plugins/solidfire/TestUploadDownload.py
index a15f27b98bf8..1c650060e22c 100644
--- a/test/integration/plugins/solidfire/TestUploadDownload.py
+++ b/test/integration/plugins/solidfire/TestUploadDownload.py
@@ -18,7 +18,7 @@
import logging
import random
import SignedAPICall
-import urllib2
+import urllib.request, urllib.error, urllib.parse
from solidfire.factory import ElementFactory
@@ -465,7 +465,7 @@ def _extract_volume_and_verify(self, volume_id, error_msg):
self._verify_uploaded_volume_present(install_path, False)
- url_response = urllib2.urlopen(extract_result.url)
+ url_response = urllib.request.urlopen(extract_result.url)
if url_response.code != 200:
raise Exception(error_msg)
@@ -486,7 +486,7 @@ def _check_removal_of_extracted_volume_state(self, volume_id, extract_result_url
if len(result) == 0:
try:
- urllib2.urlopen(extract_result_url)
+ urllib.request.urlopen(extract_result_url)
except Exception as e:
if "404" in str(e):
return True, ""
diff --git a/test/integration/plugins/solidfire/TestVMMigrationWithStorage.py b/test/integration/plugins/solidfire/TestVMMigrationWithStorage.py
index 7da6c9d542b8..3933c184b06b 100644
--- a/test/integration/plugins/solidfire/TestVMMigrationWithStorage.py
+++ b/test/integration/plugins/solidfire/TestVMMigrationWithStorage.py
@@ -660,20 +660,20 @@ def _verify_same_account(self, src_sf_volume, dest_sf_volume):
self.assertEqual(src_sf_volume.account_id, dest_sf_volume.account_id, "The source and destination volumes should be in the same SolidFire account.")
def _verifySfVolumeIds(self, src_sf_volume, dest_sf_volume):
- self.assert_(src_sf_volume.volume_id < dest_sf_volume.volume_id,
+ self.assertTrue(src_sf_volume.volume_id < dest_sf_volume.volume_id,
"The destination SolidFire root volume's ID should be greater than the id of the source one.")
# verify the name, folder, and iscsi_name
def _verifyFields(self, cs_volume, sf_volume):
- self.assert_(cs_volume.name == sf_volume.name, "The CloudStack volume name does not match the SolidFire volume name.")
+ self.assertTrue(cs_volume.name == sf_volume.name, "The CloudStack volume name does not match the SolidFire volume name.")
cs_volume_folder = self._get_cs_volume_folder(cs_volume.id)
- self.assert_(int(cs_volume_folder) == sf_volume.volume_id, "The CloudStack folder name does not match the SolidFire volume ID.")
+ self.assertTrue(int(cs_volume_folder) == sf_volume.volume_id, "The CloudStack folder name does not match the SolidFire volume ID.")
cs_volume_iscsi_name = self._get_cs_volume_iscsi_name(cs_volume.id)
- self.assert_(cs_volume_iscsi_name == sf_util.format_iqn(sf_volume.iqn), "The CloudStack volume iscsi_name does not match the SolidFire volume IQN.")
+ self.assertTrue(cs_volume_iscsi_name == sf_util.format_iqn(sf_volume.iqn), "The CloudStack volume iscsi_name does not match the SolidFire volume IQN.")
def _get_cs_volume_property(self, cs_volume_id, volume_property):
sql_query = "Select " + volume_property + " From volumes Where uuid = '" + cs_volume_id + "'"
diff --git a/test/integration/plugins/solidfire/TestVolumes.py b/test/integration/plugins/solidfire/TestVolumes.py
index 9685e509cb8d..30b5c0f1ab66 100644
--- a/test/integration/plugins/solidfire/TestVolumes.py
+++ b/test/integration/plugins/solidfire/TestVolumes.py
@@ -2617,7 +2617,7 @@ def _get_template_cache_name(self):
elif TestData.hypervisor_type == TestData.xenServer:
return TestData.templateCacheNameXenServer
- self.assert_(False, "Invalid hypervisor type")
+ self.assertTrue(False, "Invalid hypervisor type")
def _get_modified_iscsi_name(self, sf_iscsi_name):
sf_iscsi_name = sf_iscsi_name.replace("/", "")
diff --git a/test/integration/plugins/test_nicira_controller.py b/test/integration/plugins/test_nicira_controller.py
index 75f94afdb668..9524a516fc14 100644
--- a/test/integration/plugins/test_nicira_controller.py
+++ b/test/integration/plugins/test_nicira_controller.py
@@ -405,7 +405,7 @@ def get_hosts(self):
def get_master_router(self, routers):
- master = filter(lambda r: r.redundantstate == 'MASTER', routers)
+ master = [r for r in routers if r.redundantstate == 'MASTER']
self.logger.debug("Found %s master router(s): %s" % (master.size(), master))
return master[0]
diff --git a/test/integration/smoke/test_async_job.py b/test/integration/smoke/test_async_job.py
index f727dd8d7d3f..d2bcdab62129 100644
--- a/test/integration/smoke/test_async_job.py
+++ b/test/integration/smoke/test_async_job.py
@@ -71,7 +71,6 @@ def tearDownClass(cls):
def setUp(self):
self.apiclient = self.testClient.getApiClient()
self.dbclient = self.testClient.getDbConnection()
- self.hypervisor = self.testClient.getHypervisorInfo()
self.testdata["virtual_machine"]["zoneid"] = self.zone.id
self.testdata["virtual_machine"]["template"] = self.template.id
self.testdata["iso"]["zoneid"] = self.zone.id
diff --git a/test/integration/smoke/test_certauthority_root.py b/test/integration/smoke/test_certauthority_root.py
index a7cf18884a4c..6251496b1bf7 100644
--- a/test/integration/smoke/test_certauthority_root.py
+++ b/test/integration/smoke/test_certauthority_root.py
@@ -133,7 +133,7 @@ def test_issue_certificate_without_csr(self):
for domain in cmd.domain.split(','):
self.assertTrue(domain in altNames.value.get_values_for_type(x509.DNSName))
for address in cmd.ipaddress.split(','):
- self.assertTrue(address in map(lambda x: str(x), altNames.value.get_values_for_type(x509.IPAddress)))
+ self.assertTrue(address in [str(x) for x in altNames.value.get_values_for_type(x509.IPAddress)])
# Validate certificate against CA public key
global PUBKEY_VERIFY
diff --git a/test/integration/smoke/test_create_network.py b/test/integration/smoke/test_create_network.py
index 7fe7cbbc53a6..497679fc0eb4 100644
--- a/test/integration/smoke/test_create_network.py
+++ b/test/integration/smoke/test_create_network.py
@@ -17,7 +17,8 @@
# Import Local Modules
from nose.plugins.attrib import attr
-from marvin.cloudstackTestCase import cloudstackTestCase, unittest
+from marvin.cloudstackTestCase import cloudstackTestCase
+import unittest
from marvin.sshClient import SshClient
from marvin.lib.utils import (cleanup_resources,
random_gen)
diff --git a/test/integration/smoke/test_deploy_vgpu_enabled_vm.py b/test/integration/smoke/test_deploy_vgpu_enabled_vm.py
index 0bf210c6000b..6df64081ebcf 100644
--- a/test/integration/smoke/test_deploy_vgpu_enabled_vm.py
+++ b/test/integration/smoke/test_deploy_vgpu_enabled_vm.py
@@ -324,12 +324,12 @@ def test_3d_gpu_support(self):
self.assertTrue('mks.enable3d' in detailKeys and 'mks.use3dRenderer' in detailKeys and 'svga.autodetect' in detailKeys and 'svga.vramSize' in detailKeys, "VM details do not contain 3D GPU details")
- self.assertEquals('true', qresultset[detailKeys.index('mks.enable3d')][1], "Expected detail 'mks.enable3d'='true'")
+ self.assertEqual('true', qresultset[detailKeys.index('mks.enable3d')][1], "Expected detail 'mks.enable3d'='true'")
- self.assertEquals('automatic', qresultset[detailKeys.index('mks.use3dRenderer')][1], "Expected detail 'mks.use3dRenderer'='automatic'")
+ self.assertEqual('automatic', qresultset[detailKeys.index('mks.use3dRenderer')][1], "Expected detail 'mks.use3dRenderer'='automatic'")
- self.assertEquals('false', qresultset[detailKeys.index('svga.autodetect')][1], "Expected detail 'svga.autodetect'='false'")
+ self.assertEqual('false', qresultset[detailKeys.index('svga.autodetect')][1], "Expected detail 'svga.autodetect'='false'")
- self.assertEquals('131072', qresultset[detailKeys.index('svga.vramSize')][1], "Expected detail 'svga.vramSize'='131072'")
+ self.assertEqual('131072', qresultset[detailKeys.index('svga.vramSize')][1], "Expected detail 'svga.vramSize'='131072'")
return
diff --git a/test/integration/smoke/test_deploy_virtio_scsi_vm.py b/test/integration/smoke/test_deploy_virtio_scsi_vm.py
index 0bcf999882df..b1bbfda83a13 100644
--- a/test/integration/smoke/test_deploy_virtio_scsi_vm.py
+++ b/test/integration/smoke/test_deploy_virtio_scsi_vm.py
@@ -197,7 +197,7 @@ def verifyVirshState(self, diskcount):
for child in disk:
if child.tag.lower() == "target":
dev = child.get("dev")
- self.assert_(dev is not None and dev.startswith("sd"), "disk dev is invalid")
+ self.assertTrue(dev is not None and dev.startswith("sd"), "disk dev is invalid")
elif child.tag.lower() == "address":
con = child.get("controller")
self.assertEqual(con, scsiindex, "disk controller not equal to SCSI " \
diff --git a/test/integration/smoke/test_deploy_vm_extra_config_data.py b/test/integration/smoke/test_deploy_vm_extra_config_data.py
index 3078cce0362e..80b046102ca9 100644
--- a/test/integration/smoke/test_deploy_vm_extra_config_data.py
+++ b/test/integration/smoke/test_deploy_vm_extra_config_data.py
@@ -17,7 +17,7 @@
""" BVT tests for Virtual Machine additional configuration
"""
# Import System modules
-import urllib
+import urllib.request, urllib.parse, urllib.error
import xml.etree.ElementTree as ET
from lxml import etree
@@ -292,7 +292,7 @@ def test_02_deploy_vm_with_extraconfig_kvm(self):
xml_res = ssh_client.execute(virsh_cmd)
xml_as_str = ''.join(xml_res)
- extraconfig_decoded_xml = '' + urllib.unquote(extraconfig) + ''
+ extraconfig_decoded_xml = '' + urllib.parse.unquote(extraconfig) + ''
# Root XML Elements
parser = etree.XMLParser(remove_blank_text=True)
@@ -302,7 +302,7 @@ def test_02_deploy_vm_with_extraconfig_kvm(self):
find_element_in_domain_xml = domain_xml_root.find(child.tag)
# Fail if extra config is not found in domain xml
- self.assertNotEquals(
+ self.assertNotEqual(
0,
len(find_element_in_domain_xml),
'Element tag from extra config not added to VM'
@@ -310,7 +310,7 @@ def test_02_deploy_vm_with_extraconfig_kvm(self):
# Compare found XML node with extra config node
is_a_match = self.elements_equal(child, find_element_in_domain_xml)
- self.assertEquals(
+ self.assertEqual(
True,
is_a_match,
'The element from tags from extra config do not match with those found in domain xml'
@@ -371,7 +371,7 @@ def test_03_update_vm_with_extraconfig_kvm(self):
xml_res = ssh_client.execute(virsh_cmd)
xml_as_str = ''.join(xml_res)
- extraconfig_decoded_xml = '' + urllib.unquote(extraconfig) + ''
+ extraconfig_decoded_xml = '' + urllib.parse.unquote(extraconfig) + ''
# Root XML Elements
parser = etree.XMLParser(remove_blank_text=True)
@@ -381,7 +381,7 @@ def test_03_update_vm_with_extraconfig_kvm(self):
find_element_in_domain_xml = domain_xml_root.find(child.tag)
# Fail if extra config is not found in domain xml
- self.assertNotEquals(
+ self.assertNotEqual(
0,
len(find_element_in_domain_xml),
'Element tag from extra config not added to VM'
@@ -389,7 +389,7 @@ def test_03_update_vm_with_extraconfig_kvm(self):
# Compare found XML node with extra config node
is_a_match = self.elements_equal(child, find_element_in_domain_xml)
- self.assertEquals(
+ self.assertEqual(
True,
is_a_match,
'The element from tags from extra config do not match with those found in domain xml'
@@ -462,7 +462,7 @@ def test_05_deploy_vm_with_extraconfig_vmware(self):
user=self.hostConfig['username'],
passwd=self.hostConfig['password'])
- extraconfig_decoded = urllib.unquote(extraconfig)
+ extraconfig_decoded = urllib.parse.unquote(extraconfig)
config_arr = extraconfig_decoded.splitlines()
for config in config_arr:
@@ -472,7 +472,7 @@ def test_05_deploy_vm_with_extraconfig_vmware(self):
grep_config = "cat %s | grep -w '%s'" % (vmx_file_name, vmx_config)
result = ssh_client.execute(grep_config)
# Match exact configuration from vmx file, return empty result array if configuration is not found
- self.assertNotEquals(
+ self.assertNotEqual(
0,
len(result),
'Extra configuration not found in instance vmx file'
@@ -546,7 +546,7 @@ def test_07_deploy_vm_with_extraconfig_xenserver(self):
user=self.hostConfig['username'],
passwd=self.hostConfig['password'])
- extraconfig_decoded = urllib.unquote(extraconfig)
+ extraconfig_decoded = urllib.parse.unquote(extraconfig)
config_arr = extraconfig_decoded.splitlines()
# Get vm instance uuid
@@ -558,7 +558,7 @@ def test_07_deploy_vm_with_extraconfig_xenserver(self):
result = ssh_client.execute(vm_config_check)
param_value = config_tuple[1].strip()
# Check if each configuration command has set the configuration as sent with extraconfig
- self.assertEquals(
+ self.assertEqual(
param_value,
result[0],
'Extra configuration not found in VM param list'
diff --git a/test/integration/smoke/test_deploy_vm_with_userdata.py b/test/integration/smoke/test_deploy_vm_with_userdata.py
index 52b71f7ea1aa..ced0d3cf255d 100644
--- a/test/integration/smoke/test_deploy_vm_with_userdata.py
+++ b/test/integration/smoke/test_deploy_vm_with_userdata.py
@@ -91,10 +91,10 @@ def test_deployvm_userdata_post(self):
domainid=self.account.domainid,
id=deployVmResponse.id
)
- self.assert_(len(vms) > 0, "There are no Vms deployed in the account %s" % self.account.name)
+ self.assertTrue(len(vms) > 0, "There are no Vms deployed in the account %s" % self.account.name)
vm = vms[0]
- self.assert_(vm.id == str(deployVmResponse.id), "Vm deployed is different from the test")
- self.assert_(vm.state == "Running", "VM is not in Running state")
+ self.assertTrue(vm.id == str(deployVmResponse.id), "Vm deployed is different from the test")
+ self.assertTrue(vm.state == "Running", "VM is not in Running state")
@attr(tags=["devcloud", "basic", "advanced"], required_hardware="true")
def test_deployvm_userdata(self):
@@ -115,10 +115,10 @@ def test_deployvm_userdata(self):
domainid=self.account.domainid,
id=deployVmResponse.id
)
- self.assert_(len(vms) > 0, "There are no Vms deployed in the account %s" % self.account.name)
+ self.assertTrue(len(vms) > 0, "There are no Vms deployed in the account %s" % self.account.name)
vm = vms[0]
- self.assert_(vm.id == str(deployVmResponse.id), "Vm deployed is different from the test")
- self.assert_(vm.state == "Running", "VM is not in Running state")
+ self.assertTrue(vm.id == str(deployVmResponse.id), "Vm deployed is different from the test")
+ self.assertTrue(vm.state == "Running", "VM is not in Running state")
@classmethod
def tearDownClass(cls):
diff --git a/test/integration/smoke/test_deploy_vms_with_varied_deploymentplanners.py b/test/integration/smoke/test_deploy_vms_with_varied_deploymentplanners.py
index 181958d74e5a..ebd7739d8782 100644
--- a/test/integration/smoke/test_deploy_vms_with_varied_deploymentplanners.py
+++ b/test/integration/smoke/test_deploy_vms_with_varied_deploymentplanners.py
@@ -156,8 +156,8 @@ def test_deployvm_userdispersing(self):
"Running",
msg="VM is not in Running state"
)
- vm1clusterid = filter(lambda c: c.id == vm1.hostid, self.hosts)[0].clusterid
- vm2clusterid = filter(lambda c: c.id == vm2.hostid, self.hosts)[0].clusterid
+ vm1clusterid = [c for c in self.hosts if c.id == vm1.hostid][0].clusterid
+ vm2clusterid = [c for c in self.hosts if c.id == vm2.hostid][0].clusterid
if vm1clusterid == vm2clusterid:
self.debug("VMs (%s, %s) meant to be dispersed are deployed in the same cluster %s" % (
vm1.id, vm2.id, vm1clusterid))
@@ -215,11 +215,11 @@ def test_deployvm_userconcentrated(self):
"Running",
msg="VM is not in Running state"
)
- vm1clusterid = filter(lambda c: c.id == vm1.hostid, self.hosts)[0].clusterid
- vm2clusterid = filter(lambda c: c.id == vm2.hostid, self.hosts)[0].clusterid
+ vm1clusterid = [c for c in self.hosts if c.id == vm1.hostid][0].clusterid
+ vm2clusterid = [c for c in self.hosts if c.id == vm2.hostid][0].clusterid
- vm1podid = filter(lambda p: p.id == vm1clusterid, self.clusters)[0].podid
- vm2podid = filter(lambda p: p.id == vm2clusterid, self.clusters)[0].podid
+ vm1podid = [p for p in self.clusters if p.id == vm1clusterid][0].podid
+ vm2podid = [p for p in self.clusters if p.id == vm2clusterid][0].podid
self.assertEqual(
vm1podid,
vm2podid,
diff --git a/test/integration/smoke/test_diagnostics.py b/test/integration/smoke/test_diagnostics.py
index 176f74b9b335..809a2a587072 100644
--- a/test/integration/smoke/test_diagnostics.py
+++ b/test/integration/smoke/test_diagnostics.py
@@ -16,7 +16,7 @@
# under the License.
""" BVT tests for remote diagnostics of system VMs
"""
-import urllib
+import urllib.request, urllib.parse, urllib.error
from marvin.cloudstackAPI import (runDiagnostics, getDiagnosticsData)
from marvin.cloudstackTestCase import cloudstackTestCase
@@ -566,14 +566,14 @@ def test_13_retrieve_vr_default_files(self):
)
def check_url(self, url):
- import urllib2
+ import urllib.request, urllib.error, urllib.parse
try:
- r = urllib.urlopen(url)
+ r = urllib.request.urlopen(url)
if r.code == 200:
return True
- except urllib2.HTTPError:
+ except urllib.error.HTTPError:
return False
- except urllib2.URLError:
+ except urllib.error.URLError:
return False
return True
diff --git a/test/integration/smoke/test_domain_vpc_offerings.py b/test/integration/smoke/test_domain_vpc_offerings.py
index d24e05bd7d72..6482f49c340b 100644
--- a/test/integration/smoke/test_domain_vpc_offerings.py
+++ b/test/integration/smoke/test_domain_vpc_offerings.py
@@ -151,7 +151,7 @@ def test_01_create_vpc_offering(self):
cmd.supportedServices = offering_data["supportedservices"]
cmd.domainid = offering_data_domainid
if "serviceProviderList" in offering_data:
- for service, provider in offering_data["serviceProviderList"].items():
+ for service, provider in list(offering_data["serviceProviderList"].items()):
providers = provider
if isinstance(provider, str):
providers = [provider]
diff --git a/test/integration/smoke/test_dynamicroles.py b/test/integration/smoke/test_dynamicroles.py
index 2ce70011c2c6..b91ba9c2eba8 100644
--- a/test/integration/smoke/test_dynamicroles.py
+++ b/test/integration/smoke/test_dynamicroles.py
@@ -456,19 +456,19 @@ def test_rolepermission_lifecycle_update(self):
# Move last item to the top
rule = permissions.pop(len(permissions)-1)
permissions = [rule] + permissions
- rule.update(self.apiclient, ruleorder=",".join(map(lambda x: x.id, permissions)))
+ rule.update(self.apiclient, ruleorder=",".join([x.id for x in permissions]))
self.validate_permissions_list(permissions, self.role.id)
# Move to the bottom
rule = permissions.pop(0)
permissions = permissions + [rule]
- rule.update(self.apiclient, ruleorder=",".join(map(lambda x: x.id, permissions)))
+ rule.update(self.apiclient, ruleorder=",".join([x.id for x in permissions]))
self.validate_permissions_list(permissions, self.role.id)
# Random shuffles
for _ in range(3):
shuffle(permissions)
- rule.update(self.apiclient, ruleorder=",".join(map(lambda x: x.id, permissions)))
+ rule.update(self.apiclient, ruleorder=",".join([x.id for x in permissions]))
self.validate_permissions_list(permissions, self.role.id)
@attr(tags=['advanced', 'simulator', 'basic', 'sg'], required_hardware=False)
@@ -541,7 +541,7 @@ def test_rolepermission_lifecycle_concurrent_updates(self):
shuffle(permissions)
try:
- permission.update(self.apiclient, ruleorder=",".join(map(lambda x: x.id, permissions)))
+ permission.update(self.apiclient, ruleorder=",".join([x.id for x in permissions]))
self.fail("Reordering should fail in case of concurrent updates by other user")
except CloudstackAPIException: pass
@@ -566,9 +566,9 @@ def checkApiAvailability(self, apiConfig, userApiClient):
Checks available APIs based on api map
"""
response = userApiClient.listApis(listApis.listApisCmd())
- allowedApis = map(lambda x: x.name, response)
+ allowedApis = [x.name for x in response]
for api in allowedApis:
- for rule, perm in apiConfig.items():
+ for rule, perm in list(apiConfig.items()):
if re.match(rule.replace('*', '.*'), api):
if perm.lower() == 'allow':
break
@@ -612,7 +612,7 @@ def test_role_account_acls(self):
Test to check role, role permissions and account life cycles
"""
apiConfig = self.testdata['apiConfig']
- for api, perm in apiConfig.items():
+ for api, perm in list(apiConfig.items()):
testdata = self.testdata['rolepermission']
testdata['roleid'] = self.role.id
testdata['rule'] = api
@@ -641,7 +641,7 @@ def test_role_account_acls_multiple_mgmt_servers(self):
apiConfig = self.testdata["apiConfig"]
roleId = self.dbclient.execute("select id from roles where uuid='%s'" % self.role.id)[0][0]
sortOrder = 1
- for rule, perm in apiConfig.items():
+ for rule, perm in list(apiConfig.items()):
self.dbclient.execute("insert into role_permissions (uuid, role_id, rule, permission, sort_order) values (UUID(), %d, '%s', '%s', %d)" % (roleId, rule, perm.upper(), sortOrder))
sortOrder += 1
diff --git a/test/integration/smoke/test_host_annotations.py b/test/integration/smoke/test_host_annotations.py
index 9ce2586c8128..a463af9e7fe1 100644
--- a/test/integration/smoke/test_host_annotations.py
+++ b/test/integration/smoke/test_host_annotations.py
@@ -107,7 +107,7 @@ def test_02_add_multiple_annotations(self):
#Check that the last one is visible in host details
self.assertEqual(self.getHostAnnotation(self.host.id), "annotation3")
- print
+ print()
@attr(tags=["devcloud", "advanced", "advancedns", "smoke", "basic", "sg"], required_hardware="false")
def test_03_user_role_dont_see_annotations(self):
diff --git a/test/integration/smoke/test_hostha_kvm.py b/test/integration/smoke/test_hostha_kvm.py
index cd4a2d412a45..ea289c23be41 100644
--- a/test/integration/smoke/test_hostha_kvm.py
+++ b/test/integration/smoke/test_hostha_kvm.py
@@ -30,7 +30,7 @@
import random
import socket
import sys
-import thread
+import _thread
import time
@@ -187,7 +187,7 @@ def enableAgent(self):
def waitUntilHostInState(self, state="Available", interval=3):
def checkForState(expectedState):
response = self.getHost(self.host.id)
- print("checkForState:: expected=%s, actual=%s" % (state, response.hostha))
+ print(("checkForState:: expected=%s, actual=%s" % (state, response.hostha)))
return response.hostha.hastate == expectedState, None
res, _ = wait_until(interval, 200, checkForState, state)
@@ -511,7 +511,7 @@ def startIpmiServer(tname, server):
IpmiServerContext('reset')
ThreadedIpmiServer.allow_reuse_address = False
server = ThreadedIpmiServer(('0.0.0.0', self.getIpmiServerPort()), IpmiServer)
- thread.start_new_thread(startIpmiServer, ("ipmi-server", server,))
+ _thread.start_new_thread(startIpmiServer, ("ipmi-server", server,))
self.server = server
def stopIpmiServer(self):
diff --git a/test/integration/smoke/test_hostha_simulator.py b/test/integration/smoke/test_hostha_simulator.py
index bb25d477d02f..9590891d093f 100644
--- a/test/integration/smoke/test_hostha_simulator.py
+++ b/test/integration/smoke/test_hostha_simulator.py
@@ -28,7 +28,7 @@
import random
import socket
import sys
-import thread
+import _thread
import time
@@ -173,7 +173,7 @@ def getSimulatorHAStateTransitions(self, hostId):
def checkSyncToState(self, state, interval=5000):
def checkForStateSync(expectedState):
response = self.getHost(hostId=self.getHost().id).hostha
- print("checkForStateSync:: response=%s, expected=%s" % (response, expectedState))
+ print(("checkForStateSync:: response=%s, expected=%s" % (response, expectedState)))
return response.hastate == expectedState, None
sync_interval = 1 + int(interval) / 1000
@@ -417,7 +417,7 @@ def test_ha_multiple_mgmt_server_ownership(self):
mshosts = self.dbclient.execute(
"select msid from mshost where version='%s' and removed is NULL and state='Up'" % (cloudstackVersion))
if len(mshosts) > 0:
- currentMsHosts = map(lambda row: row[0], mshosts)
+ currentMsHosts = [row[0] for row in mshosts]
# Inject fake ms host
self.dbclient.execute(
@@ -475,7 +475,7 @@ def checkHaOwnershipExpiry(fakeMsId):
def checkFSMTransition(self, transition, event, haState, prevHaState, hasActiviyCounter, hasRecoveryCounter):
- print("checkFSMTransition:: transition=%s, event=%s, state=%s" % (transition, event, haState))
+ print(("checkFSMTransition:: transition=%s, event=%s, state=%s" % (transition, event, haState)))
self.assertEqual(transition.event, event)
self.assertEqual(transition.hastate, haState)
self.assertEqual(transition.prevhastate, prevHaState)
@@ -513,7 +513,7 @@ def findFSMTransitionToState(self, state, host):
if not stateTransition:
previousTransition = transition
- print("findFSMTransition:: prev=%s, cur=%s, next=%s, find state=%s" % (previousTransition, stateTransition, nextTransition, state))
+ print(("findFSMTransition:: prev=%s, cur=%s, next=%s, find state=%s" % (previousTransition, stateTransition, nextTransition, state)))
if stateTransition:
return True, (previousTransition, stateTransition, nextTransition,)
return False, (previousTransition, stateTransition, nextTransition,)
diff --git a/test/integration/smoke/test_internal_lb.py b/test/integration/smoke/test_internal_lb.py
index 1f4751761dbc..941a0f427740 100644
--- a/test/integration/smoke/test_internal_lb.py
+++ b/test/integration/smoke/test_internal_lb.py
@@ -370,7 +370,7 @@ def deployvm_in_network(self, vpc, networkid):
)
self.assertIsNotNone(
vm, "Failed to deploy vm in network: %s" % networkid)
- self.assert_(vm.state == 'Running', "VM is not running")
+ self.assertTrue(vm.state == 'Running', "VM is not running")
self.logger.debug("Deployed VM id: %s in VPC %s" % (vm.id, vpc.id))
self.cleanup.insert(0, vm)
@@ -510,7 +510,7 @@ def get_std_deviation(self, data):
""" Calculates and outputs a mean, variance and standard deviation from an input list of values """
num_val = len(data)
mean = sum(data) / num_val
- sqrt = map(lambda x: math.pow(abs(x - mean), 2), data)
+ sqrt = [math.pow(abs(x - mean), 2) for x in data]
variance = (sum(sqrt) / num_val - 1)
stddev = math.sqrt(variance)
return (mean, variance, stddev)
diff --git a/test/integration/smoke/test_iso.py b/test/integration/smoke/test_iso.py
index 53e42cb1cb3d..c592b6bc6060 100644
--- a/test/integration/smoke/test_iso.py
+++ b/test/integration/smoke/test_iso.py
@@ -18,7 +18,8 @@
"""
# Import Local Modules
from marvin.cloudstackException import GetDetailExceptionInfo
-from marvin.cloudstackTestCase import cloudstackTestCase, unittest
+from marvin.cloudstackTestCase import cloudstackTestCase
+import unittest
from marvin.cloudstackAPI import listZones, updateIso, extractIso, updateIsoPermissions, copyIso, deleteIso,\
registerIso,listOsTypes
from marvin.lib.utils import cleanup_resources, random_gen, get_hypervisor_type,validateList
@@ -29,7 +30,7 @@
list_os_types)
from nose.plugins.attrib import attr
from marvin.codes import PASS
-import urllib
+import urllib.request, urllib.parse, urllib.error
# Import System modules
import time
@@ -260,7 +261,7 @@ def get_iso_details(self, isoname):
isready="true"
)
status = validateList(list_default_iso_response)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"Check if ISO exists in ListIsos")
@@ -404,8 +405,8 @@ def test_04_extract_Iso(self):
try:
# Format URL to ASCII to retrieve response code
- formatted_url = urllib.unquote_plus(list_extract_response.url)
- url_response = urllib.urlopen(formatted_url)
+ formatted_url = urllib.parse.unquote_plus(list_extract_response.url)
+ url_response = urllib.request.urlopen(formatted_url)
response_code = url_response.getcode()
except Exception:
self.fail(
@@ -515,9 +516,7 @@ def test_06_copy_iso(self):
self.skipTest(
"Not enough zones available to perform copy template")
- self.services["destzoneid"] = filter(
- lambda z: z.id != self.zone.id,
- self.zones)[0].id
+ self.services["destzoneid"] = [z for z in self.zones if z.id != self.zone.id][0].id
self.debug("Copy ISO from %s to %s" % (
self.zone.id,
@@ -688,8 +687,8 @@ def test_01_1_create_iso_with_checksum_sha1_negative(self):
try:
self.download(self.apiclient, iso.id)
except Exception as e:
- print "Negative Test Passed - Exception Occurred Under iso download " \
- "%s" % GetDetailExceptionInfo(e)
+ print("Negative Test Passed - Exception Occurred Under iso download " \
+ "%s" % GetDetailExceptionInfo(e))
else:
self.fail("Negative Test Failed - Exception DID NOT Occurred Under iso download ")
@@ -701,8 +700,8 @@ def test_02_1_create_iso_with_checksum_sha256_negative(self):
try:
self.download(self.apiclient, iso.id)
except Exception as e:
- print "Negative Test Passed - Exception Occurred Under iso download " \
- "%s" % GetDetailExceptionInfo(e)
+ print("Negative Test Passed - Exception Occurred Under iso download " \
+ "%s" % GetDetailExceptionInfo(e))
else:
self.fail("Negative Test Failed - Exception DID NOT Occurred Under iso download ")
@@ -714,8 +713,8 @@ def test_03_1_create_iso_with_checksum_md5_negative(self):
try:
self.download(self.apiclient, iso.id)
except Exception as e:
- print "Negative Test Passed - Exception Occurred Under iso download " \
- "%s" % GetDetailExceptionInfo(e)
+ print("Negative Test Passed - Exception Occurred Under iso download " \
+ "%s" % GetDetailExceptionInfo(e))
else:
self.fail("Negative Test Failed - Exception DID NOT Occurred Under iso download ")
@@ -777,4 +776,4 @@ def download(self, apiclient, iso_id, retries=12, interval=5):
else:
retries = retries - 1
- raise Exception("Template download failed exception.")
\ No newline at end of file
+ raise Exception("Template download failed exception.")
diff --git a/test/integration/smoke/test_kubernetes_clusters.py b/test/integration/smoke/test_kubernetes_clusters.py
index f2f0471cfbf4..f469756d10c9 100644
--- a/test/integration/smoke/test_kubernetes_clusters.py
+++ b/test/integration/smoke/test_kubernetes_clusters.py
@@ -17,7 +17,8 @@
""" Tests for Kubernetes supported version """
#Import Local Modules
-from marvin.cloudstackTestCase import cloudstackTestCase, unittest
+from marvin.cloudstackTestCase import cloudstackTestCase
+import unittest
from marvin.cloudstackAPI import (listInfrastructure,
listTemplates,
listKubernetesSupportedVersions,
@@ -225,7 +226,7 @@ def getKubernetesTemplate(cls, cks_templates=None):
hypervisor = cls.hypervisor.lower()
- if hypervisor not in cks_templates.keys():
+ if hypervisor not in list(cks_templates.keys()):
cls.debug("Provided hypervisor has no CKS template")
return FAILED
diff --git a/test/integration/smoke/test_kubernetes_supported_versions.py b/test/integration/smoke/test_kubernetes_supported_versions.py
index ffeb00599d4d..a6e478666732 100644
--- a/test/integration/smoke/test_kubernetes_supported_versions.py
+++ b/test/integration/smoke/test_kubernetes_supported_versions.py
@@ -17,7 +17,8 @@
""" Tests for Kubernetes supported version """
#Import Local Modules
-from marvin.cloudstackTestCase import cloudstackTestCase, unittest
+from marvin.cloudstackTestCase import cloudstackTestCase
+import unittest
from marvin.cloudstackAPI import (listInfrastructure,
listKubernetesSupportedVersions,
addKubernetesSupportedVersion,
diff --git a/test/integration/smoke/test_login.py b/test/integration/smoke/test_login.py
index 5855feabd9fe..40d8349a13da 100644
--- a/test/integration/smoke/test_login.py
+++ b/test/integration/smoke/test_login.py
@@ -69,7 +69,7 @@ def login(self, username, password, domain="/"):
try:
resp = session.post(self.server_url, params=args, verify=False)
- except requests.exceptions.ConnectionError, e:
+ except requests.exceptions.ConnectionError as e:
self.fail("Failed to attempt login request to mgmt server")
return None, None
diff --git a/test/integration/smoke/test_migration.py b/test/integration/smoke/test_migration.py
index ab5532a16cd7..3b21a0b39366 100644
--- a/test/integration/smoke/test_migration.py
+++ b/test/integration/smoke/test_migration.py
@@ -18,7 +18,8 @@
""" Network migration test
"""
# Import Local Modules
-from marvin.cloudstackTestCase import cloudstackTestCase, unittest
+from marvin.cloudstackTestCase import cloudstackTestCase
+import unittest
from marvin.lib.base import (
Account,
ServiceOffering,
@@ -228,12 +229,12 @@ def test_01_native_to_native_network_migration(self):
domainid=self.account.domainid,
id=deployVmResponse.id
)
- self.assert_(len(vms) > 0, "There are no Vms deployed in the account"
+ self.assertTrue(len(vms) > 0, "There are no Vms deployed in the account"
" %s" % self.account.name)
vm = vms[0]
- self.assert_(vm.id == str(deployVmResponse.id),
+ self.assertTrue(vm.id == str(deployVmResponse.id),
"Vm deployed is different from the test")
- self.assert_(vm.state == "Running", "VM is not in Running state")
+ self.assertTrue(vm.state == "Running", "VM is not in Running state")
self.migrate_network(
self.network_offering_nouserdata,
diff --git a/test/integration/smoke/test_nested_virtualization.py b/test/integration/smoke/test_nested_virtualization.py
index 10dcf895ed9f..547c05d9a8a8 100644
--- a/test/integration/smoke/test_nested_virtualization.py
+++ b/test/integration/smoke/test_nested_virtualization.py
@@ -108,8 +108,8 @@ def test_nested_virtualization_vmware(self):
serviceofferingid=self.service_offering.id,
mode=self.services['mode']
)
- self.assert_(virtual_machine is not None, "VM failed to deploy")
- self.assert_(virtual_machine.state == 'Running', "VM is not running")
+ self.assertTrue(virtual_machine is not None, "VM failed to deploy")
+ self.assertTrue(virtual_machine.state == 'Running', "VM is not running")
self.logger.debug("Deployed vm: %s" % virtual_machine.id)
isolated_network = Network.create(
@@ -137,7 +137,7 @@ def test_nested_virtualization_vmware(self):
self.rollback_nested_configurations(rollback_nv, rollback_nv_per_vm)
#5) Check for CPU flags: vmx for Intel and svm for AMD indicates nested virtualization is enabled
- self.assert_(result is not None, "Empty result for CPU flags")
+ self.assertTrue(result is not None, "Empty result for CPU flags")
res = str(result)
self.assertTrue('vmx' in res or 'svm' in res)
except Exception as e:
@@ -157,5 +157,5 @@ def rollback_nested_configurations(self, rollback_nv, rollback_nv_per_vm):
def tearDownClass(cls):
try:
cleanup_resources(cls.apiclient, cls.cleanup)
- except Exception, e:
+ except Exception as e:
raise Exception("Cleanup failed with %s" % e)
diff --git a/test/integration/smoke/test_network.py b/test/integration/smoke/test_network.py
index 99d96d7bdef1..5540750874c0 100644
--- a/test/integration/smoke/test_network.py
+++ b/test/integration/smoke/test_network.py
@@ -1735,7 +1735,7 @@ def is_vm_l2_isolated_from_dest(self, vm, eth_device, dest_ip):
return len(response) == 3
def enable_l2_nic(self, vm):
- vm_ip = list(filter(lambda x: x['networkid'] == self.isolated_network.id, vm.nic))[0]['ipaddress']
+ vm_ip = list([x for x in vm.nic if x['networkid'] == self.isolated_network.id])[0]['ipaddress']
ssh_client = vm.get_ssh_client()
eth_device = "eth0"
if len(ssh_client.execute("/sbin/ifconfig %s | grep %s" % (eth_device, vm_ip))) > 0:
diff --git a/test/integration/smoke/test_network_acl.py b/test/integration/smoke/test_network_acl.py
index 7b8aa369125e..0914f4dc2d4e 100644
--- a/test/integration/smoke/test_network_acl.py
+++ b/test/integration/smoke/test_network_acl.py
@@ -62,11 +62,11 @@ def test_network_acl(self):
# 0) Get the default network offering for VPC
networkOffering = NetworkOffering.list(self.apiclient, name="DefaultIsolatedNetworkOfferingForVpcNetworks")
- self.assert_(networkOffering is not None and len(networkOffering) > 0, "No VPC based network offering")
+ self.assertTrue(networkOffering is not None and len(networkOffering) > 0, "No VPC based network offering")
# 1) Create VPC
vpcOffering = VpcOffering.list(self.apiclient, name="Default VPC offering")
- self.assert_(vpcOffering is not None and len(vpcOffering)>0, "No VPC offerings found")
+ self.assertTrue(vpcOffering is not None and len(vpcOffering)>0, "No VPC offerings found")
self.services["vpc"] = {}
self.services["vpc"]["name"] = "vpc-networkacl"
self.services["vpc"]["displaytext"] = "vpc-networkacl"
@@ -80,7 +80,7 @@ def test_network_acl(self):
account=self.account.name,
domainid=self.domain.id
)
- self.assert_(vpc is not None, "VPC creation failed")
+ self.assertTrue(vpc is not None, "VPC creation failed")
# 2) Create ACL
aclgroup = NetworkACLList.create(apiclient=self.apiclient, services={}, name="acl", description="acl", vpcid=vpc.id)
@@ -121,13 +121,13 @@ def test_network_acl(self):
domainid= self.domain.id,
serviceofferingid=self.service_offering.id,
)
- self.assert_(vm is not None, "VM failed to deploy")
- self.assert_(vm.state == 'Running', "VM is not running")
+ self.assertTrue(vm is not None, "VM failed to deploy")
+ self.assertTrue(vm.state == 'Running', "VM is not running")
self.debug("VM %s deployed in VPC %s" %(vm.id, vpc.id))
@classmethod
def tearDownClass(cls):
try:
cleanup_resources(cls.apiclient, cls.cleanup)
- except Exception, e:
+ except Exception as e:
raise Exception("Cleanup failed with %s" % e)
diff --git a/test/integration/smoke/test_nic.py b/test/integration/smoke/test_nic.py
index b24c3fa34258..093c99e36f87 100644
--- a/test/integration/smoke/test_nic.py
+++ b/test/integration/smoke/test_nic.py
@@ -34,7 +34,7 @@
import logging
import time
import threading
-import Queue
+import queue
class TestNic(cloudstackTestCase):
@@ -374,7 +374,7 @@ def run(self):
# Start multiple networks
tsize = 8
- queue = Queue.Queue()
+ queue = queue.Queue()
for _ in range(tsize):
worker = NetworkMaker(queue, createNetwork)
worker.setDaemon(True)
diff --git a/test/integration/smoke/test_nic_adapter_type.py b/test/integration/smoke/test_nic_adapter_type.py
index 933b8d978949..0101cfecbcc5 100644
--- a/test/integration/smoke/test_nic_adapter_type.py
+++ b/test/integration/smoke/test_nic_adapter_type.py
@@ -22,7 +22,8 @@
# Import Local Modules
from nose.plugins.attrib import attr
-from marvin.cloudstackTestCase import cloudstackTestCase, unittest
+from marvin.cloudstackTestCase import cloudstackTestCase
+import unittest
from marvin.lib.base import (
Account,
ServiceOffering,
diff --git a/test/integration/smoke/test_non_contigiousvlan.py b/test/integration/smoke/test_non_contigiousvlan.py
index c7a5467b110d..3838e431655d 100644
--- a/test/integration/smoke/test_non_contigiousvlan.py
+++ b/test/integration/smoke/test_non_contigiousvlan.py
@@ -53,25 +53,25 @@ def test_extendPhysicalNetworkVlan(self):
phy_network = network
break
- self.assert_(phy_network is not None, msg="No network with vlan found")
+ self.assertTrue(phy_network is not None, msg="No network with vlan found")
self.network = phy_network
self.networkid = phy_network.id
self.existing_vlan = phy_network.vlan
vlan1 = self.existing_vlan+","+self.vlan["partial_range"][0]
updatePhysicalNetworkResponse = self.network.update(self.apiClient, id = self.networkid, vlan = vlan1)
- self.assert_(updatePhysicalNetworkResponse is not None,
+ self.assertTrue(updatePhysicalNetworkResponse is not None,
msg="couldn't extend the physical network with vlan %s"%vlan1)
- self.assert_(isinstance(self.network, PhysicalNetwork))
+ self.assertTrue(isinstance(self.network, PhysicalNetwork))
vlan2 = vlan1+","+self.vlan["partial_range"][1]
updatePhysicalNetworkResponse2 = self.network.update(self.apiClient, id = self.networkid, vlan = vlan2)
- self.assert_(updatePhysicalNetworkResponse2 is not None,
+ self.assertTrue(updatePhysicalNetworkResponse2 is not None,
msg="couldn't extend the physical network with vlan %s"%vlan2)
- self.assert_(isinstance(self.network, PhysicalNetwork))
+ self.assertTrue(isinstance(self.network, PhysicalNetwork))
vlanranges= updatePhysicalNetworkResponse2.vlan
- self.assert_(vlanranges is not None,
+ self.assertTrue(vlanranges is not None,
"No VLAN ranges found on the deployment")
@@ -86,6 +86,6 @@ def tearDown(self):
self.network = phy_networks[0]
self.networkid = phy_networks[0].id
updateResponse = self.network.update(self.apiClient, id = self.networkid, vlan=self.existing_vlan)
- self.assert_(updateResponse.vlan.find(self.vlan["full_range"]) < 0,
+ self.assertTrue(updateResponse.vlan.find(self.vlan["full_range"]) < 0,
"VLAN was not removed successfully")
diff --git a/test/integration/smoke/test_outofbandmanagement.py b/test/integration/smoke/test_outofbandmanagement.py
index a52e3b1f643b..ef5bb52ebadf 100644
--- a/test/integration/smoke/test_outofbandmanagement.py
+++ b/test/integration/smoke/test_outofbandmanagement.py
@@ -30,7 +30,7 @@
import random
import socket
import sys
-import thread
+import _thread
import time
@@ -60,7 +60,7 @@ def startIpmiServer(tname, server):
IpmiServerContext('reset')
ThreadedIpmiServer.allow_reuse_address = True
server = ThreadedIpmiServer(('0.0.0.0', cls.serverPort), IpmiServer)
- thread.start_new_thread(startIpmiServer, ("ipmi-server", server,))
+ _thread.start_new_thread(startIpmiServer, ("ipmi-server", server,))
cls.server = server
@@ -497,7 +497,7 @@ def test_oobm_multiple_mgmt_server_ownership(self):
currentMsHosts = []
mshosts = self.dbclient.execute("select msid from mshost where version='%s' and removed is NULL and state='Up'" % (cloudstackVersion))
if len(mshosts) > 0:
- currentMsHosts = map(lambda row: row[0], mshosts)
+ currentMsHosts = [row[0] for row in mshosts]
# Inject fake ms host
self.dbclient.execute("insert into mshost (msid,runid,name,state,version,service_ip,service_port,last_update) values (%s,%s,'oobm-marvin-fakebox', 'Down', '%s', '127.0.0.1', '22', NOW())" % (self.getFakeMsId(), self.getFakeMsRunId(), cloudstackVersion))
diff --git a/test/integration/smoke/test_outofbandmanagement_nestedplugin.py b/test/integration/smoke/test_outofbandmanagement_nestedplugin.py
index 13fb9dd0b858..bb8f618e471a 100644
--- a/test/integration/smoke/test_outofbandmanagement_nestedplugin.py
+++ b/test/integration/smoke/test_outofbandmanagement_nestedplugin.py
@@ -23,11 +23,11 @@
from marvin.lib.common import *
from nose.plugins.attrib import attr
-from BaseHTTPServer import BaseHTTPRequestHandler,HTTPServer
+from http.server import BaseHTTPRequestHandler,HTTPServer
import socket
import sys
-import thread
+import _thread
import time
@@ -169,7 +169,7 @@ def startMgmtServer(tname, server):
server.serve_forever()
except Exception: pass
server = HTTPServer(('0.0.0.0', self.getServerPort()), MockedCloudStackServer)
- thread.start_new_thread(startMgmtServer, ("mocked-mgmt-server", server,))
+ _thread.start_new_thread(startMgmtServer, ("mocked-mgmt-server", server,))
self.server = server
diff --git a/test/integration/smoke/test_portforwardingrules.py b/test/integration/smoke/test_portforwardingrules.py
index 8aaa088a3d36..c162dbf568a7 100644
--- a/test/integration/smoke/test_portforwardingrules.py
+++ b/test/integration/smoke/test_portforwardingrules.py
@@ -130,7 +130,7 @@ def __verify_values(self, expected_vals, actual_vals):
if len(expected_vals) != len(actual_vals):
return False
- keys = expected_vals.keys()
+ keys = list(expected_vals.keys())
for i in range(0, len(expected_vals)):
exp_val = expected_vals[keys[i]]
act_val = actual_vals[keys[i]]
@@ -187,7 +187,7 @@ def test_01_create_delete_portforwarding_fornonvpc(self):
zoneid=self.zone.id
)
status = validateList(network_offerings_list)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"Isolated Network Offerings with sourceNat,\
@@ -252,7 +252,7 @@ def test_01_create_delete_portforwarding_fornonvpc(self):
listall=self.services["listall"]
)
status = validateList(list_ipaddresses_after)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"IP Addresses Association Failed"
@@ -285,7 +285,7 @@ def test_01_create_delete_portforwarding_fornonvpc(self):
networkid=network.id
)
status = validateList(list_vms_running)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"VM Created is not in Running state"
@@ -296,7 +296,7 @@ def test_01_create_delete_portforwarding_fornonvpc(self):
len(list_ipaddresses_after),
"VM Created is not in Running state"
)
- self.assertEquals(
+ self.assertEqual(
vm_created.id,
list_vms_running[0].id,
"VM Created is not in Running state"
@@ -365,7 +365,7 @@ def test_01_create_delete_portforwarding_fornonvpc(self):
ipaddressid=associated_ipaddress.ipaddress.id
)
status = validateList(list_prtfwdrule_after)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"Failed to create Port Forwarding Rule"
diff --git a/test/integration/smoke/test_primary_storage.py b/test/integration/smoke/test_primary_storage.py
index 79778e555839..7c0a9487af67 100644
--- a/test/integration/smoke/test_primary_storage.py
+++ b/test/integration/smoke/test_primary_storage.py
@@ -527,7 +527,7 @@ def test_01_deploy_vms_storage_tags(self):
self.debug("Expected exception %s: " % e)
self.debug("Asssert that vm2 was not deployed, so it couldn't be appended to cleanup")
- self.assertEquals(cleanup_size, len(self.cleanup))
+ self.assertEqual(cleanup_size, len(self.cleanup))
# Create V-1 using DO-1
self.volume_1 = Volume.create(
@@ -567,7 +567,7 @@ def test_01_deploy_vms_storage_tags(self):
listall=True
)
self.debug("VM-1 Volumes: %s" % vm_1_volumes)
- self.assertEquals(None, vm_1_volumes, "Check that volume V-2 has not been attached to VM-1")
+ self.assertEqual(None, vm_1_volumes, "Check that volume V-2 has not been attached to VM-1")
# Attach V_1 to VM_1
self.virtual_machine_1.attach_volume(self.apiclient, self.volume_1)
@@ -578,7 +578,7 @@ def test_01_deploy_vms_storage_tags(self):
listall=True
)
self.debug("VM-1 Volumes: %s" % vm_1_volumes)
- self.assertEquals(vm_1_volumes[0].id, self.volume_1.id, "Check that volume V-1 has been attached to VM-1")
+ self.assertEqual(vm_1_volumes[0].id, self.volume_1.id, "Check that volume V-1 has been attached to VM-1")
self.virtual_machine_1.detach_volume(self.apiclient, self.volume_1)
return
@@ -586,9 +586,9 @@ def test_01_deploy_vms_storage_tags(self):
def check_storage_pool_tag(self, poolid, tag):
cmd = listStorageTags.listStorageTagsCmd()
storage_tags_response = self.apiclient.listStorageTags(cmd)
- pool_tags = filter(lambda x: x.poolid == poolid, storage_tags_response)
- self.assertEquals(1, len(pool_tags), "Check storage tags size")
- self.assertEquals(tag, pool_tags[0].name, "Check storage tag on storage pool")
+ pool_tags = [x for x in storage_tags_response if x.poolid == poolid]
+ self.assertEqual(1, len(pool_tags), "Check storage tags size")
+ self.assertEqual(tag, pool_tags[0].name, "Check storage tag on storage pool")
@attr(tags=["advanced", "advancedns", "smoke", "basic", "sg"], required_hardware="false")
@skipTestIf("hypervisorNotSupported")
@@ -600,7 +600,7 @@ def test_02_edit_primary_storage_tags(self):
"select id from storage_pool where uuid = '%s';"
% str(self.storage_pool_1.id)
)
- self.assertEquals(1, len(qresultset), "Check DB Query result set")
+ self.assertEqual(1, len(qresultset), "Check DB Query result set")
qresult = qresultset[0]
storage_pool_db_id = qresult[0]
@@ -673,11 +673,11 @@ def test_03_migration_options_storage_tags(self):
self.apiclient,
id=vol.id
)
- pools_suitable = filter(lambda p: p.suitableformigration, pools_response)
+ pools_suitable = [p for p in pools_response if p.suitableformigration]
self.debug("Suitable storage pools found: %s" % len(pools_suitable))
- self.assertEquals(1, len(pools_suitable), "Check that there is only one item on the list")
- self.assertEquals(pools_suitable[0].id, storage_pool_2.id, "Check that PS-2 is the migration option for volume")
+ self.assertEqual(1, len(pools_suitable), "Check that there is only one item on the list")
+ self.assertEqual(pools_suitable[0].id, storage_pool_2.id, "Check that PS-2 is the migration option for volume")
# Update PS-2 Storage Tags
StoragePool.update(
@@ -691,9 +691,9 @@ def test_03_migration_options_storage_tags(self):
self.apiclient,
id=vol.id
)
- pools_suitable = filter(lambda p: p.suitableformigration, pools_response)
+ pools_suitable = [p for p in pools_response if p.suitableformigration]
self.debug("Suitable storage pools found: %s" % len(pools_suitable))
- self.assertEquals(0, len(pools_suitable), "Check that there is no migration option for volume")
+ self.assertEqual(0, len(pools_suitable), "Check that there is no migration option for volume")
return
diff --git a/test/integration/smoke/test_privategw_acl.py b/test/integration/smoke/test_privategw_acl.py
index b6860c8b4375..1111a488c909 100644
--- a/test/integration/smoke/test_privategw_acl.py
+++ b/test/integration/smoke/test_privategw_acl.py
@@ -253,7 +253,7 @@ def test_01_vpc_privategw_acl(self):
)
# Find all the vlans that are for dynamic vlan allocation
- dc_vlans = sorted(map(lambda x: x[0], qresultset))
+ dc_vlans = sorted([x[0] for x in qresultset])
# Use VLAN id that is not in physical network vlan range for dynamic vlan allocation
vlan_1 = int(physical_network.vlan.split('-')[-1]) + 1
@@ -343,7 +343,7 @@ def performVPCTests(self, vpc_off, restart_with_cleanup = False):
)
# Find all the vlans that are for dynamic vlan allocation
- dc_vlans = sorted(map(lambda x: x[0], qresultset))
+ dc_vlans = sorted([x[0] for x in qresultset])
# Use VLAN id that is not in physical network vlan range for dynamic vlan allocation
vlan_1 = int(physical_network.vlan.split('-')[-1]) + 1
@@ -401,7 +401,7 @@ def performPrivateGWInterfaceTests(self, vpc_off):
)
# Find all the vlans that are for dynamic vlan allocation
- dc_vlans = sorted(map(lambda x: x[0], qresultset))
+ dc_vlans = sorted([x[0] for x in qresultset])
# Use VLAN id that is not in physical network vlan range for dynamic vlan allocation
vlan_1 = int(physical_network.vlan.split('-')[-1]) + 1
@@ -522,7 +522,7 @@ def createVPC(self, vpc_offering, cidr = '10.1.1.1/16'):
domainid=self.account.domainid)
self.logger.debug("Created VPC with ID: %s" % vpc.id)
- except Exception, e:
+ except Exception as e:
self.fail('Unable to create VPC due to %s ' % e)
return vpc
@@ -539,7 +539,7 @@ def createVM(self, network):
networkids=[str(network.id)]
)
self.logger.debug("Created VM with ID: %s" % vm.id)
- except Exception, e:
+ except Exception as e:
self.fail('Unable to create virtual machine due to %s ' % e)
return vm
@@ -554,7 +554,7 @@ def createStaticRoute(self, privateGwId, cidr = '10.0.0.0/16'):
self.assertIsNotNone(staticRoute.id, "Failed to create static route.")
self.logger.debug("Created staticRoute with ID: %s" % staticRoute.id)
- except Exception, e:
+ except Exception as e:
self.fail('Unable to create static route due to %s ' % e)
return staticRoute
@@ -569,7 +569,7 @@ def createACL(self, vpc):
self.assertIsNotNone(acl.id, "Failed to create ACL.")
self.logger.debug("Created ACL with ID: %s" % acl.id)
- except Exception, e:
+ except Exception as e:
self.fail('Unable to create ACL due to %s ' % e)
return acl
@@ -586,7 +586,7 @@ def createACLItem(self, aclId, cidr = "0.0.0.0/0"):
self.assertIsNotNone(aclItem.id, "Failed to create ACL item.")
self.logger.debug("Created ACL Item ID: %s" % aclItem.id)
- except Exception, e:
+ except Exception as e:
self.fail('Unable to create ACL Item due to %s ' % e)
def createNetwork(self, vpc, net_offering = "network_offering", gateway = '10.1.1.1'):
@@ -618,7 +618,7 @@ def createNetwork(self, vpc, net_offering = "network_offering", gateway = '10.1.
)
self.logger.debug("Created network with ID: %s" % obj_network.id)
- except Exception, e:
+ except Exception as e:
self.fail('Unable to create a Network with offering=%s because of %s ' % (net_offerring, e))
self.cleanup.insert(0, nw_off)
diff --git a/test/integration/smoke/test_projects.py b/test/integration/smoke/test_projects.py
index f4c340da756b..05004a44118c 100644
--- a/test/integration/smoke/test_projects.py
+++ b/test/integration/smoke/test_projects.py
@@ -259,8 +259,8 @@ def test_01_create_multiple_projects_by_account(self):
"Check list project response returns a valid project"
)
- self.assert_(isinstance(self.user.user, list))
- self.assert_(len(self.user.user) > 0,
+ self.assertTrue(isinstance(self.user.user, list))
+ self.assertTrue(len(self.user.user) > 0,
msg="Account %s has no users" % self.user.name)
self.debug(
"Adding account %s to project with email %s" %
diff --git a/test/integration/smoke/test_pvlan.py b/test/integration/smoke/test_pvlan.py
old mode 100644
new mode 100755
index 0ed4b441c4cb..335a96465f71
--- a/test/integration/smoke/test_pvlan.py
+++ b/test/integration/smoke/test_pvlan.py
@@ -17,18 +17,16 @@
""" test for private vlan isolation
"""
#Import Local Modules
-import marvin
from marvin.cloudstackTestCase import *
+from marvin.cloudstackException import CloudstackAPIException
from marvin.cloudstackAPI import *
-from marvin.sshClient import SshClient
from marvin.lib.utils import *
from marvin.lib.base import *
from marvin.lib.common import *
+
+from nose2.tools.such import helper
from nose.plugins.attrib import attr
-import telnetlib
-#Import System modules
-import time
_multiprocess_shared_ = True
class TestPVLAN(cloudstackTestCase):
@@ -38,10 +36,14 @@ class TestPVLAN(cloudstackTestCase):
vlan = 2468
isolatedpvlan = 864
+ @classmethod
+ def setUpClass(cls):
+ cls.testClient = super(TestPVLAN, cls).getClsTestClient()
+
def setUp(self):
self.apiClient = self.testClient.getApiClient()
- @attr(tags = ["advanced"], required_hardware="false")
+ @attr(tags = ["advanced", "nose2"], required_hardware="false")
def test_create_pvlan_network(self):
self.debug("Test create pvlan network")
createNetworkCmd = createNetwork.createNetworkCmd()
@@ -78,5 +80,6 @@ def test_create_pvlan_network(self):
createNetworkCmd.startipv6="fc00:1234::10"
createNetworkCmd.endipv6="fc00:1234::20"
err = 0
- with self.assertRaises(Exception):
+ with helper.assertRaises(CloudstackAPIException):
self.apiClient.createNetwork(createNetworkCmd)
+
diff --git a/test/integration/smoke/test_regions.py b/test/integration/smoke/test_regions.py
index a6823c6ea359..36f92e7f68c7 100644
--- a/test/integration/smoke/test_regions.py
+++ b/test/integration/smoke/test_regions.py
@@ -43,7 +43,7 @@ def setUp(self):
self.domain = get_domain(self.apiclient)
self.cleanup = []
- pseudo_random_int = choice(xrange(2, 200))
+ pseudo_random_int = choice(range(2, 200))
self.services["region"]["regionid"] = pseudo_random_int
self.services["region"]["regionname"] = "region" + str(pseudo_random_int)
self.services["region"]["regionendpoint"] = "http://region" + str(pseudo_random_int) + ":8080/client"
@@ -107,7 +107,7 @@ def test_createRegionWithExistingRegionId(self):
def test_createRegionWithExistingRegionName(self):
"""Test for duplicate checks on region name
"""
- random_int = choice(xrange(2, 200))
+ random_int = choice(range(2, 200))
self.services["region"]["regionid"] = random_int # alter id but not name
self.services["region"]["regionendpoint"] = "http://region" + str(random_int) + ":8080/client"
self.assertRaises(Exception, Region.create, self.apiclient, self.services["region"])
diff --git a/test/integration/smoke/test_routers_iptables_default_policy.py b/test/integration/smoke/test_routers_iptables_default_policy.py
index c077b56e582a..a4eda3546bb0 100644
--- a/test/integration/smoke/test_routers_iptables_default_policy.py
+++ b/test/integration/smoke/test_routers_iptables_default_policy.py
@@ -576,7 +576,7 @@ def create_network(self, net_offerring, vpc_id, gateway='10.1.1.1'):
vpcid=vpc_id)
self.logger.debug("Created network with ID: %s" % obj_network.id)
- except Exception, e:
+ except Exception as e:
raise Exception('Unable to create a Network with offering=%s because of %s ' % (net_offerring, e))
o = networkO(obj_network)
diff --git a/test/integration/smoke/test_scale_vm.py b/test/integration/smoke/test_scale_vm.py
index ddd6bcfbc71e..ee0e49ec1aff 100644
--- a/test/integration/smoke/test_scale_vm.py
+++ b/test/integration/smoke/test_scale_vm.py
@@ -209,4 +209,4 @@ def test_01_scale_vm(self):
'Running',
"Check the state of VM"
)
- return
\ No newline at end of file
+ return
diff --git a/test/integration/smoke/test_secondary_storage.py b/test/integration/smoke/test_secondary_storage.py
index baa0f98935ed..5b339ae67b97 100644
--- a/test/integration/smoke/test_secondary_storage.py
+++ b/test/integration/smoke/test_secondary_storage.py
@@ -184,7 +184,7 @@ def test_02_sys_template_ready(self):
hypervisors[cluster.hypervisor] = "self"
for zid in self.zones:
- for k, v in hypervisors.items():
+ for k, v in list(hypervisors.items()):
self.debug("Checking BUILTIN templates in zone: %s" %zid)
list_template_response = list_templates(
self.apiclient,
diff --git a/test/integration/smoke/test_staticroles.py b/test/integration/smoke/test_staticroles.py
index 2300da5cd6ea..5184b6a68145 100644
--- a/test/integration/smoke/test_staticroles.py
+++ b/test/integration/smoke/test_staticroles.py
@@ -86,7 +86,7 @@ def setUp(self):
self.roleApiMap = {} # role to list of apis allowed
octetKey = {'Admin':1, 'DomainAdmin':4, 'User':8}
- for role in octetKey.keys():
+ for role in list(octetKey.keys()):
for api in sorted(apiMap.keys()):
if (octetKey[role] & int(apiMap[api])) > 0:
if role not in self.roleApiMap:
@@ -125,8 +125,8 @@ def test_static_role_account_acls(self):
)
self.cleanup.append(account)
userApiClient = self.testClient.getUserApiClient(UserName=account.name, DomainName=account.domain, type=accountType)
- allowedApis = map(lambda x: x.name, userApiClient.listApis(listApis.listApisCmd()))
- allApis = map(lambda x: x.name, self.apiclient.listApis(listApis.listApisCmd()))
+ allowedApis = [x.name for x in userApiClient.listApis(listApis.listApisCmd())]
+ allApis = [x.name for x in self.apiclient.listApis(listApis.listApisCmd())]
for api in self.roleApiMap[role]:
if api not in allApis:
continue
diff --git a/test/integration/smoke/test_templates.py b/test/integration/smoke/test_templates.py
index dd724b8171c9..3243b5ca0e34 100644
--- a/test/integration/smoke/test_templates.py
+++ b/test/integration/smoke/test_templates.py
@@ -20,7 +20,8 @@
from marvin.cloudstackException import *
from marvin.cloudstackAPI import *
from marvin.codes import FAILED
-from marvin.cloudstackTestCase import cloudstackTestCase, unittest
+from marvin.cloudstackTestCase import cloudstackTestCase
+import unittest
from marvin.cloudstackAPI import listZones
from marvin.lib.utils import random_gen, cleanup_resources
from marvin.lib.base import (Account,
@@ -34,7 +35,7 @@
get_zone,
get_template)
from nose.plugins.attrib import attr
-import urllib
+import urllib.request, urllib.parse, urllib.error
#Import System modules
import time
from marvin.cloudstackAPI import (createTemplate, listOsTypes)
@@ -143,8 +144,8 @@ def test_02_1_create_template_with_checksum_sha1_negative(self):
try:
self.download(self.apiclient, template.id)
except Exception as e:
- print "Negative Test Passed - Exception Occurred Under template download " \
- "%s" % GetDetailExceptionInfo(e)
+ print("Negative Test Passed - Exception Occurred Under template download " \
+ "%s" % GetDetailExceptionInfo(e))
else:
self.fail("Negative Test Failed - Exception DID NOT Occurred Under template download ")
@@ -156,8 +157,8 @@ def test_03_1_create_template_with_checksum_sha256_negative(self):
try:
self.download(self.apiclient, template.id)
except Exception as e:
- print "Negative Test Passed - Exception Occurred Under template download " \
- "%s" % GetDetailExceptionInfo(e)
+ print("Negative Test Passed - Exception Occurred Under template download " \
+ "%s" % GetDetailExceptionInfo(e))
else:
self.fail("Negative Test Failed - Exception DID NOT Occurred Under template download ")
@@ -169,8 +170,8 @@ def test_04_1_create_template_with_checksum_md5_negative(self):
try:
self.download(self.apiclient, template.id)
except Exception as e:
- print "Negative Test Passed - Exception Occurred Under template download " \
- "%s" % GetDetailExceptionInfo(e)
+ print("Negative Test Passed - Exception Occurred Under template download " \
+ "%s" % GetDetailExceptionInfo(e))
else:
self.fail("Negative Test Failed - Exception DID NOT Occurred Under template download ")
@@ -727,8 +728,8 @@ def test_04_extract_template(self):
try:
# Format URL to ASCII to retrieve response code
- formatted_url = urllib.unquote_plus(list_extract_response.url)
- url_response = urllib.urlopen(formatted_url)
+ formatted_url = urllib.parse.unquote_plus(list_extract_response.url)
+ url_response = urllib.request.urlopen(formatted_url)
response_code = url_response.getcode()
except Exception:
@@ -819,7 +820,7 @@ def test_06_copy_template(self):
if len(self.zones) <= 1:
self.skipTest("Not enough zones available to perform copy template")
- self.services["destzoneid"] = filter(lambda z: z.id != self.services["sourcezoneid"], self.zones)[0].id
+ self.services["destzoneid"] = [z for z in self.zones if z.id != self.services["sourcezoneid"]][0].id
self.debug("Copy template from Zone: %s to %s" % (
self.services["sourcezoneid"],
diff --git a/test/integration/smoke/test_update_security_group.py b/test/integration/smoke/test_update_security_group.py
index 41e4d596907a..95bf7b2d924f 100644
--- a/test/integration/smoke/test_update_security_group.py
+++ b/test/integration/smoke/test_update_security_group.py
@@ -21,7 +21,8 @@
# Import Local Modules
from nose.plugins.attrib import attr
-from marvin.cloudstackTestCase import cloudstackTestCase, unittest
+from marvin.cloudstackTestCase import cloudstackTestCase
+import unittest
from marvin.cloudstackAPI import updateSecurityGroup, createSecurityGroup
from marvin.sshClient import SshClient
from marvin.lib.utils import (validateList,
diff --git a/test/integration/smoke/test_usage.py b/test/integration/smoke/test_usage.py
index 54139e4737f8..2100859ba52f 100644
--- a/test/integration/smoke/test_usage.py
+++ b/test/integration/smoke/test_usage.py
@@ -19,7 +19,8 @@
# Import Local Modules
from marvin.codes import FAILED
from nose.plugins.attrib import attr
-from marvin.cloudstackTestCase import cloudstackTestCase, unittest
+from marvin.cloudstackTestCase import cloudstackTestCase
+import unittest
from marvin.cloudstackAPI import deleteVolume
from marvin.lib.utils import (cleanup_resources,get_hypervisor_type)
from marvin.lib.base import (Account,
diff --git a/test/integration/smoke/test_vm_life_cycle.py b/test/integration/smoke/test_vm_life_cycle.py
index 08668e47b727..51662ac253f0 100644
--- a/test/integration/smoke/test_vm_life_cycle.py
+++ b/test/integration/smoke/test_vm_life_cycle.py
@@ -745,7 +745,7 @@ def test_10_attachAndDetach_iso(self):
(self.virtual_machine.ipaddress, e))
mount_dir = "/mnt/tmp"
cmds = "mkdir -p %s" % mount_dir
- self.assert_(ssh_client.execute(cmds) == [], "mkdir failed within guest")
+ self.assertTrue(ssh_client.execute(cmds) == [], "mkdir failed within guest")
iso_unsupported = False
for diskdevice in self.services["diskdevice"]:
@@ -756,7 +756,7 @@ def test_10_attachAndDetach_iso(self):
if str(res).find("mount: unknown filesystem type 'iso9660'") != -1:
iso_unsupported = True
self.debug("Test template does not supports iso9660 filesystem. Proceeding with test without mounting.")
- print "Test template does not supports iso9660 filesystem. Proceeding with test without mounting."
+ print("Test template does not supports iso9660 filesystem. Proceeding with test without mounting.")
break
else:
self.fail("No mount points matched. Mount was unsuccessful")
@@ -964,7 +964,7 @@ def migrate_and_check(self, vm, src_host, dest_host, proto='tls'):
def waitUntilHostInState(self, hostId, state="Up", interval=5, retries=20):
while retries > -1:
- print("Waiting for host: %s to be %s. %s retries left." % (hostId, state, retries))
+ print(("Waiting for host: %s to be %s. %s retries left." % (hostId, state, retries)))
time.sleep(interval)
host = Host.list(
self.apiclient,
@@ -976,7 +976,7 @@ def waitUntilHostInState(self, hostId, state="Up", interval=5, retries=20):
retries = retries - 1
continue
else:
- print("Host %s now showing as %s" % (hostId, state))
+ print(("Host %s now showing as %s" % (hostId, state)))
return
def unsecure_host(self, host):
@@ -988,7 +988,7 @@ def unsecure_host(self, host):
service libvirtd restart && \
sleep 30 && \
service cloudstack-agent restart")
- print("Unsecuring Host: %s" % (host.name))
+ print(("Unsecuring Host: %s" % (host.name)))
self.waitUntilHostInState(hostId=host.id, state="Up")
self.check_connection(host=host, secured='false')
return host
@@ -1001,7 +1001,7 @@ def secure_all_hosts(self):
self.apiclient.provisionCertificate(cmd)
for host in self.hosts:
- print("Securing Host %s" % host.name)
+ print(("Securing Host %s" % host.name))
self.waitUntilHostInState(hostId=host.id, state="Up")
self.check_connection(secured='true', host=host)
diff --git a/test/integration/smoke/test_volumes.py b/test/integration/smoke/test_volumes.py
index aa4eaf13fa4d..f66985233d4a 100644
--- a/test/integration/smoke/test_volumes.py
+++ b/test/integration/smoke/test_volumes.py
@@ -17,7 +17,8 @@
""" BVT tests for Volumes
"""
#Import Local Modules
-from marvin.cloudstackTestCase import cloudstackTestCase, unittest
+from marvin.cloudstackTestCase import cloudstackTestCase
+import unittest
#from marvin.cloudstackException import *
from marvin.cloudstackAPI import (deleteVolume,
extractVolume,
@@ -44,7 +45,7 @@
from nose.plugins.attrib import attr
#Import System modules
import os
-import urllib
+import urllib.request, urllib.parse, urllib.error
import time
import tempfile
@@ -143,7 +144,7 @@ def test_01_create_volume(self):
# 2. Verify the size of volume with actual size allocated
self.volumes = []
- for k, v in self.services["volume_offerings"].items():
+ for k, v in list(self.services["volume_offerings"].items()):
volume = Volume.create(
self.apiClient,
v,
@@ -548,9 +549,9 @@ def test_06_download_detached_volume(self):
#Attempt to download the volume and save contents locally
try:
- formatted_url = urllib.unquote_plus(extract_vol.url)
+ formatted_url = urllib.parse.unquote_plus(extract_vol.url)
self.debug("Attempting to download volume at url %s" % formatted_url)
- response = urllib.urlopen(formatted_url)
+ response = urllib.request.urlopen(formatted_url)
self.debug("response from volume url %s" % response.getcode())
fd, path = tempfile.mkstemp()
self.debug("Saving volume %s to path %s" %(self.volume.id, path))
diff --git a/test/integration/smoke/test_vpc_redundant.py b/test/integration/smoke/test_vpc_redundant.py
index fe6b4108fbf9..9144985d6ce1 100644
--- a/test/integration/smoke/test_vpc_redundant.py
+++ b/test/integration/smoke/test_vpc_redundant.py
@@ -437,7 +437,7 @@ def create_network(self, net_offerring, gateway='10.1.1.1', vpc=None, nr_vms=2,
)
self.logger.debug("Created network with ID: %s" % obj_network.id)
- except Exception, e:
+ except Exception as e:
self.fail('Unable to create a Network with offering=%s because of %s ' % (net_offerring, e))
o = networkO(obj_network)
diff --git a/test/integration/smoke/test_vpc_router_nics.py b/test/integration/smoke/test_vpc_router_nics.py
index 854ab5675420..90323e075fe7 100644
--- a/test/integration/smoke/test_vpc_router_nics.py
+++ b/test/integration/smoke/test_vpc_router_nics.py
@@ -306,7 +306,7 @@ def create_network(self, net_offerring, gateway='10.1.1.1', vpc=None):
self.logger.debug("Created network with ID: %s" % obj_network.id)
- except Exception, e:
+ except Exception as e:
self.fail('Unable to create a Network with offering=%s because of %s ' % (net_offerring, e))
o = networkO(obj_network)
diff --git a/test/integration/smoke/test_vpc_vpn.py b/test/integration/smoke/test_vpc_vpn.py
index 26b1daf946f0..10046afa6bde 100644
--- a/test/integration/smoke/test_vpc_vpn.py
+++ b/test/integration/smoke/test_vpc_vpn.py
@@ -258,12 +258,12 @@ def test_01_vpc_remote_access_vpn(self):
self.logger.debug("Retrieving default VPC offering")
networkOffering = NetworkOffering.list(
self.apiclient, name="DefaultIsolatedNetworkOfferingForVpcNetworks")
- self.assert_(networkOffering is not None and len(
+ self.assertTrue(networkOffering is not None and len(
networkOffering) > 0, "No VPC based network offering")
# 1) Create VPC
vpcOffering = VpcOffering.list(self.apiclient, name="Default VPC offering")
- self.assert_(vpcOffering is not None and len(
+ self.assertTrue(vpcOffering is not None and len(
vpcOffering) > 0, "No VPC offerings found")
vpc = None
@@ -281,7 +281,7 @@ def test_01_vpc_remote_access_vpn(self):
except Exception as e:
self.fail(e)
finally:
- self.assert_(vpc is not None, "VPC creation failed")
+ self.assertTrue(vpc is not None, "VPC creation failed")
self.logger.debug("VPC %s created" % (vpc.id))
try:
@@ -314,9 +314,9 @@ def test_01_vpc_remote_access_vpn(self):
networkids=ntwk.id,
hypervisor=self.hypervisor
)
- self.assert_(vm is not None, "VM failed to deploy")
+ self.assertTrue(vm is not None, "VM failed to deploy")
self.cleanup.append(vm)
- self.assert_(vm.state == 'Running', "VM is not running")
+ self.assertTrue(vm.state == 'Running', "VM is not running")
self.debug("VM %s deployed in VPC %s" % (vm.id, vpc.id))
except Exception as e:
self.fail(e)
@@ -528,12 +528,12 @@ def test_01_vpc_site2site_vpn(self):
# 0) Get the default network offering for VPC
networkOffering = NetworkOffering.list(
self.apiclient, name="DefaultIsolatedNetworkOfferingForVpcNetworks")
- self.assert_(networkOffering is not None and len(
+ self.assertTrue(networkOffering is not None and len(
networkOffering) > 0, "No VPC based network offering")
# Create and Enable VPC offering
vpc_offering = self._create_vpc_offering('vpc_offering')
- self.assert_(vpc_offering is not None, "Failed to create VPC Offering")
+ self.assertTrue(vpc_offering is not None, "Failed to create VPC Offering")
vpc_offering.update(self.apiclient, state='Enabled')
vpc1 = None
@@ -551,7 +551,7 @@ def test_01_vpc_site2site_vpn(self):
except Exception as e:
self.fail(e)
finally:
- self.assert_(vpc1 is not None, "VPC1 creation failed")
+ self.assertTrue(vpc1 is not None, "VPC1 creation failed")
self.cleanup.append(vpc1)
self.logger.debug("VPC1 %s created" % vpc1.id)
@@ -570,7 +570,7 @@ def test_01_vpc_site2site_vpn(self):
except Exception as e:
self.fail(e)
finally:
- self.assert_(vpc2 is not None, "VPC2 creation failed")
+ self.assertTrue(vpc2 is not None, "VPC2 creation failed")
self.cleanup.append(vpc2)
self.logger.debug("VPC2 %s created" % vpc2.id)
@@ -632,8 +632,8 @@ def test_01_vpc_site2site_vpn(self):
except Exception as e:
self.fail(e)
finally:
- self.assert_(vm1 is not None, "VM failed to deploy")
- self.assert_(vm1.state == 'Running', "VM is not running")
+ self.assertTrue(vm1 is not None, "VM failed to deploy")
+ self.assertTrue(vm1.state == 'Running', "VM is not running")
self.cleanup.append(vm1)
self.logger.debug("VM %s deployed in VPC %s" % (vm1.id, vpc1.id))
@@ -652,19 +652,19 @@ def test_01_vpc_site2site_vpn(self):
except Exception as e:
self.fail(e)
finally:
- self.assert_(vm2 is not None, "VM failed to deploy")
- self.assert_(vm2.state == 'Running', "VM is not running")
+ self.assertTrue(vm2 is not None, "VM failed to deploy")
+ self.assertTrue(vm2.state == 'Running', "VM is not running")
self.cleanup.append(vm2)
self.debug("VM %s deployed in VPC %s" % (vm2.id, vpc2.id))
# 4) Enable Site-to-Site VPN for VPC
vpn1_response = Vpn.createVpnGateway(self.apiclient, vpc1.id)
- self.assert_(
+ self.assertTrue(
vpn1_response is not None, "Failed to enable VPN Gateway 1")
self.logger.debug("VPN gateway for VPC %s enabled" % vpc1.id)
vpn2_response = Vpn.createVpnGateway(self.apiclient, vpc2.id)
- self.assert_(
+ self.assertTrue(
vpn2_response is not None, "Failed to enable VPN Gateway 2")
self.logger.debug("VPN gateway for VPC %s enabled" % vpc2.id)
@@ -735,7 +735,7 @@ def checkVpnConnected():
except Exception as e:
self.fail(e)
finally:
- self.assert_(
+ self.assertTrue(
vm2.public_ip is not None, "Failed to aqcuire public ip for vm2")
natrule = None
@@ -746,7 +746,7 @@ def checkVpnConnected():
except Exception as e:
self.fail(e)
finally:
- self.assert_(
+ self.assertTrue(
natrule is not None, "Failed to create portforward for vm2")
time.sleep(20)
@@ -757,7 +757,7 @@ def checkVpnConnected():
# run ping test
packet_loss = ssh_client.execute("/bin/ping -c 3 -t 10 " + vm1.nic[0].ipaddress + " | grep packet | sed 's/.*received, //g' | sed 's/[% ]*packet.*//g'")[0]
# during startup, some packets may not reply due to link/ipsec-route setup
- self.assert_(int(packet_loss) < 50, "Ping did not succeed")
+ self.assertTrue(int(packet_loss) < 50, "Ping did not succeed")
else:
self.fail("Failed to setup ssh connection to %s" % vm2.public_ip)
@@ -899,13 +899,13 @@ def test_01_redundant_vpc_site2site_vpn(self):
# 0) Get the default network offering for VPC
networkOffering = NetworkOffering.list(
self.apiclient, name="DefaultIsolatedNetworkOfferingForVpcNetworks")
- self.assert_(networkOffering is not None and len(
+ self.assertTrue(networkOffering is not None and len(
networkOffering) > 0, "No VPC based network offering")
# Create and enable redundant VPC offering
redundant_vpc_offering = self._create_vpc_offering(
'redundant_vpc_offering')
- self.assert_(redundant_vpc_offering is not None,
+ self.assertTrue(redundant_vpc_offering is not None,
"Failed to create redundant VPC Offering")
redundant_vpc_offering.update(self.apiclient, state='Enabled')
@@ -924,7 +924,7 @@ def test_01_redundant_vpc_site2site_vpn(self):
except Exception as e:
self.fail(e)
finally:
- self.assert_(vpc1 is not None, "VPC1 creation failed")
+ self.assertTrue(vpc1 is not None, "VPC1 creation failed")
self.cleanup.append(vpc1)
self.logger.debug("VPC1 %s created" % vpc1.id)
@@ -943,7 +943,7 @@ def test_01_redundant_vpc_site2site_vpn(self):
except Exception as e:
self.fail(e)
finally:
- self.assert_(vpc2 is not None, "VPC2 creation failed")
+ self.assertTrue(vpc2 is not None, "VPC2 creation failed")
self.cleanup.append(vpc2)
self.logger.debug("VPC2 %s created" % vpc2.id)
@@ -1005,8 +1005,8 @@ def test_01_redundant_vpc_site2site_vpn(self):
except Exception as e:
self.fail(e)
finally:
- self.assert_(vm1 is not None, "VM failed to deploy")
- self.assert_(vm1.state == 'Running', "VM is not running")
+ self.assertTrue(vm1 is not None, "VM failed to deploy")
+ self.assertTrue(vm1.state == 'Running', "VM is not running")
self.cleanup.append(vm1)
self.logger.debug("VM %s deployed in VPC %s" % (vm1.id, vpc1.id))
@@ -1025,19 +1025,19 @@ def test_01_redundant_vpc_site2site_vpn(self):
except Exception as e:
self.fail(e)
finally:
- self.assert_(vm2 is not None, "VM failed to deploy")
- self.assert_(vm2.state == 'Running', "VM is not running")
+ self.assertTrue(vm2 is not None, "VM failed to deploy")
+ self.assertTrue(vm2.state == 'Running', "VM is not running")
self.cleanup.append(vm2)
self.debug("VM %s deployed in VPC %s" % (vm2.id, vpc2.id))
# 4) Enable Site-to-Site VPN for VPC
vpn1_response = Vpn.createVpnGateway(self.apiclient, vpc1.id)
- self.assert_(
+ self.assertTrue(
vpn1_response is not None, "Failed to enable VPN Gateway 1")
self.logger.debug("VPN gateway for VPC %s enabled" % vpc1.id)
vpn2_response = Vpn.createVpnGateway(self.apiclient, vpc2.id)
- self.assert_(
+ self.assertTrue(
vpn2_response is not None, "Failed to enable VPN Gateway 2")
self.logger.debug("VPN gateway for VPC %s enabled" % vpc2.id)
@@ -1108,7 +1108,7 @@ def checkVpnConnected():
except Exception as e:
self.fail(e)
finally:
- self.assert_(
+ self.assertTrue(
vm2.public_ip is not None, "Failed to aqcuire public ip for vm2")
# Create port forward to be able to ssh into vm2
@@ -1119,7 +1119,7 @@ def checkVpnConnected():
except Exception as e:
self.fail(e)
finally:
- self.assert_(
+ self.assertTrue(
natrule is not None, "Failed to create portforward for vm2")
time.sleep(20)
@@ -1129,7 +1129,7 @@ def checkVpnConnected():
if ssh_client:
# run ping test
packet_loss = ssh_client.execute("/bin/ping -c 3 -t 10 " + vm1.nic[0].ipaddress + " | grep packet | sed 's/.*received, //g' | sed 's/[% ]*packet.*//g'")[0]
- self.assert_(int(packet_loss) < 50, "Ping did not succeed")
+ self.assertTrue(int(packet_loss) < 50, "Ping did not succeed")
else:
self.fail("Failed to setup ssh connection to %s" % vm2.public_ip)
@@ -1280,12 +1280,12 @@ def test_01_vpc_site2site_vpn_multiple_options(self):
# 0) Get the default network offering for VPC
networkOffering = NetworkOffering.list(
self.apiclient, name="DefaultIsolatedNetworkOfferingForVpcNetworks")
- self.assert_(networkOffering is not None and len(
+ self.assertTrue(networkOffering is not None and len(
networkOffering) > 0, "No VPC based network offering")
# Create and Enable VPC offering
vpc_offering = self._create_vpc_offering('vpc_offering')
- self.assert_(vpc_offering is not None, "Failed to create VPC Offering")
+ self.assertTrue(vpc_offering is not None, "Failed to create VPC Offering")
vpc_offering.update(self.apiclient, state='Enabled')
vpc1 = None
@@ -1303,7 +1303,7 @@ def test_01_vpc_site2site_vpn_multiple_options(self):
except Exception as e:
self.fail(e)
finally:
- self.assert_(vpc1 is not None, "VPC1 creation failed")
+ self.assertTrue(vpc1 is not None, "VPC1 creation failed")
self.cleanup.append(vpc1)
self.logger.debug("VPC1 %s created" % vpc1.id)
@@ -1322,7 +1322,7 @@ def test_01_vpc_site2site_vpn_multiple_options(self):
except Exception as e:
self.fail(e)
finally:
- self.assert_(vpc2 is not None, "VPC2 creation failed")
+ self.assertTrue(vpc2 is not None, "VPC2 creation failed")
self.cleanup.append(vpc2)
self.logger.debug("VPC2 %s created" % vpc2.id)
@@ -1384,8 +1384,8 @@ def test_01_vpc_site2site_vpn_multiple_options(self):
except Exception as e:
self.fail(e)
finally:
- self.assert_(vm1 is not None, "VM failed to deploy")
- self.assert_(vm1.state == 'Running', "VM is not running")
+ self.assertTrue(vm1 is not None, "VM failed to deploy")
+ self.assertTrue(vm1.state == 'Running', "VM is not running")
self.cleanup.append(vm1)
self.logger.debug("VM %s deployed in VPC %s" % (vm1.id, vpc1.id))
@@ -1404,8 +1404,8 @@ def test_01_vpc_site2site_vpn_multiple_options(self):
except Exception as e:
self.fail(e)
finally:
- self.assert_(vm2 is not None, "VM failed to deploy")
- self.assert_(vm2.state == 'Running', "VM is not running")
+ self.assertTrue(vm2 is not None, "VM failed to deploy")
+ self.assertTrue(vm2.state == 'Running', "VM is not running")
self.cleanup.append(vm2)
self.debug("VM %s deployed in VPC %s" % (vm2.id, vpc2.id))
@@ -1446,12 +1446,12 @@ def test_01_vpc_site2site_vpn_multiple_options(self):
# 4) Enable Site-to-Site VPN for VPC
vpn1_response = Vpn.createVpnGateway(self.apiclient, vpc1.id)
- self.assert_(
+ self.assertTrue(
vpn1_response is not None, "Failed to enable VPN Gateway 1")
self.logger.debug("VPN gateway for VPC %s enabled" % vpc1.id)
vpn2_response = Vpn.createVpnGateway(self.apiclient, vpc2.id)
- self.assert_(
+ self.assertTrue(
vpn2_response is not None, "Failed to enable VPN Gateway 2")
self.logger.debug("VPN gateway for VPC %s enabled" % vpc2.id)
@@ -1488,7 +1488,7 @@ def test_01_vpc_site2site_vpn_multiple_options(self):
except Exception as e:
self.fail(e)
finally:
- self.assert_(
+ self.assertTrue(
vm2.public_ip is not None, "Failed to aqcuire public ip for vm2")
natrule = None
@@ -1499,7 +1499,7 @@ def test_01_vpc_site2site_vpn_multiple_options(self):
except Exception as e:
self.fail(e)
finally:
- self.assert_(
+ self.assertTrue(
natrule is not None, "Failed to create portforward for vm2")
time.sleep(20)
@@ -1559,7 +1559,7 @@ def checkVpnConnected():
# run ping test
packet_loss = ssh_client.execute("/bin/ping -c 3 -t 10 " + vm1.nic[0].ipaddress + " | grep packet | sed 's/.*received, //g' | sed 's/[% ]*packet.*//g'")[0]
self.logger.debug("Packet loss %s" % packet_loss)
- self.assert_(int(packet_loss) < 50, "Ping did not succeed")
+ self.assertTrue(int(packet_loss) < 50, "Ping did not succeed")
# Cleanup
Vpn.deleteVpnConnection(self.apiclient, vpnconn1_response['id'])
diff --git a/test/integration/testpaths/testpath_snapshot_hadrning.py b/test/integration/testpaths/testpath_snapshot_hadrning.py
index cb31f0f2fced..feca9373e402 100755
--- a/test/integration/testpaths/testpath_snapshot_hadrning.py
+++ b/test/integration/testpaths/testpath_snapshot_hadrning.py
@@ -18,7 +18,8 @@
"""
from nose.plugins.attrib import attr
-from marvin.cloudstackTestCase import cloudstackTestCase, unittest
+from marvin.cloudstackTestCase import cloudstackTestCase
+import unittest
from marvin.lib.utils import (cleanup_resources,
is_snapshot_on_nfs,
validateList)
@@ -1438,7 +1439,7 @@ def setUpClass(cls):
# Check each clusterid has two Storage Pool Tags
# which indicate two Storage Pools exist.
assert (len(clusterid_tag_mapping)) >= 2 and\
- (len(tags) for tags in clusterid_tag_mapping.itervalues(
+ (len(tags) for tags in clusterid_tag_mapping.values(
)) >= 2, "There must be atleast two Clusters and\
each must have atleast two cluster wide storage pools in\
Up state in the setup"
diff --git a/test/integration/testpaths/testpath_storage_migration.py b/test/integration/testpaths/testpath_storage_migration.py
index d696f24485a5..e9817f800397 100644
--- a/test/integration/testpaths/testpath_storage_migration.py
+++ b/test/integration/testpaths/testpath_storage_migration.py
@@ -17,7 +17,8 @@
""" Test cases for Test Paths Storage Migration
"""
from nose.plugins.attrib import attr
-from marvin.cloudstackTestCase import cloudstackTestCase, unittest
+from marvin.cloudstackTestCase import cloudstackTestCase
+import unittest
from marvin.lib.utils import (cleanup_resources)
from marvin.lib.base import (Account,
ServiceOffering,
@@ -3539,7 +3540,7 @@ def check_files(self, vm, destinationHost):
self.apiclient,
virtualmachineid=vm.id,
listall=True)
- print vm_volumes
+ print(vm_volumes)
for vol in vm_volumes:
spool = list_storage_pools(self.apiclient, id=vol.storageid)
split_path = spool[0].path.split("/")
diff --git a/test/integration/testpaths/testpath_usage.py b/test/integration/testpaths/testpath_usage.py
index 5f36c694d7c7..9d04ffaf09fa 100644
--- a/test/integration/testpaths/testpath_usage.py
+++ b/test/integration/testpaths/testpath_usage.py
@@ -2989,19 +2989,19 @@ def test_01_positive_tests_usagetypes_listTypes(self):
"""
usageTypes = [
{
- "usagetypeid": 1, "description": u'Running Vm Usage'}, {
- "usagetypeid": 2, "description": u'Allocated Vm Usage'}, {
- "usagetypeid": 3, "description": u'IP Address Usage'}, {
- "usagetypeid": 4, "description": u'Network Usage (Bytes Sent)'}, {
- "usagetypeid": 5, "description": u'Network Usage (Bytes Received)'}, {
- "usagetypeid": 6, "description": u'Volume Usage'}, {
- "usagetypeid": 7, "description": u'Template Usage'}, {
- "usagetypeid": 8, "description": u'ISO Usage'}, {
- "usagetypeid": 9, "description": u'Snapshot Usage'}, {
- "usagetypeid": 11, "description": u'Load Balancer Usage'}, {
- "usagetypeid": 12, "description": u'Port Forwarding Usage'}, {
- "usagetypeid": 13, "description": u'Network Offering Usage'}, {
- "usagetypeid": 14, "description": u'VPN users usage'
+ "usagetypeid": 1, "description": 'Running Vm Usage'}, {
+ "usagetypeid": 2, "description": 'Allocated Vm Usage'}, {
+ "usagetypeid": 3, "description": 'IP Address Usage'}, {
+ "usagetypeid": 4, "description": 'Network Usage (Bytes Sent)'}, {
+ "usagetypeid": 5, "description": 'Network Usage (Bytes Received)'}, {
+ "usagetypeid": 6, "description": 'Volume Usage'}, {
+ "usagetypeid": 7, "description": 'Template Usage'}, {
+ "usagetypeid": 8, "description": 'ISO Usage'}, {
+ "usagetypeid": 9, "description": 'Snapshot Usage'}, {
+ "usagetypeid": 11, "description": 'Load Balancer Usage'}, {
+ "usagetypeid": 12, "description": 'Port Forwarding Usage'}, {
+ "usagetypeid": 13, "description": 'Network Offering Usage'}, {
+ "usagetypeid": 14, "description": 'VPN users usage'
}
]
listTypes = []
diff --git a/test/integration/testpaths/testpath_volume_cuncurrent_snapshots.py b/test/integration/testpaths/testpath_volume_cuncurrent_snapshots.py
index ffc6fd0615a5..2c0d39bd0488 100644
--- a/test/integration/testpaths/testpath_volume_cuncurrent_snapshots.py
+++ b/test/integration/testpaths/testpath_volume_cuncurrent_snapshots.py
@@ -19,7 +19,8 @@
"""
from nose.plugins.attrib import attr
-from marvin.cloudstackTestCase import cloudstackTestCase, unittest
+from marvin.cloudstackTestCase import cloudstackTestCase
+import unittest
from marvin.lib.utils import (cleanup_resources, is_snapshot_on_nfs,
validateList)
from marvin.lib.base import (Account,
diff --git a/test/integration/testpaths/testpath_volume_recurring_snap.py b/test/integration/testpaths/testpath_volume_recurring_snap.py
index 23e0b3a73ac2..828d4cf7266f 100644
--- a/test/integration/testpaths/testpath_volume_recurring_snap.py
+++ b/test/integration/testpaths/testpath_volume_recurring_snap.py
@@ -17,7 +17,8 @@
""" Test cases for VM/Volume recurring snapshot Test Path
"""
from nose.plugins.attrib import attr
-from marvin.cloudstackTestCase import cloudstackTestCase, unittest
+from marvin.cloudstackTestCase import cloudstackTestCase
+import unittest
from marvin.lib.utils import (cleanup_resources,
is_snapshot_on_nfs,
validateList
diff --git a/test/integration/testpaths/testpath_volume_snapshot.py b/test/integration/testpaths/testpath_volume_snapshot.py
index c0e609a289b6..a9b0ae3cb488 100644
--- a/test/integration/testpaths/testpath_volume_snapshot.py
+++ b/test/integration/testpaths/testpath_volume_snapshot.py
@@ -17,7 +17,8 @@
""" Test cases for VM/Volume snapshot Test Path
"""
from nose.plugins.attrib import attr
-from marvin.cloudstackTestCase import cloudstackTestCase, unittest
+from marvin.cloudstackTestCase import cloudstackTestCase
+import unittest
from marvin.lib.utils import (cleanup_resources,
is_snapshot_on_nfs,
validateList)
diff --git a/test/integration/testpaths/testpath_volumelifecycle.py b/test/integration/testpaths/testpath_volumelifecycle.py
index a2e8390df85c..78733fcc9689 100644
--- a/test/integration/testpaths/testpath_volumelifecycle.py
+++ b/test/integration/testpaths/testpath_volumelifecycle.py
@@ -17,7 +17,8 @@
"""Utilities functions
"""
# All tests inherit from cloudstackTestCase
-from marvin.cloudstackTestCase import cloudstackTestCase, unittest
+from marvin.cloudstackTestCase import cloudstackTestCase
+import unittest
# Import Integration Libraries
from marvin.codes import FAILED, PASS
# base - contains all resources as entities and defines create, delete,
@@ -41,7 +42,7 @@
find_storage_pool_type)
from nose.plugins.attrib import attr
import os
-import urllib
+import urllib.request, urllib.parse, urllib.error
import tempfile
@@ -514,11 +515,11 @@ def test_01_positive_path(self):
self.debug("extracted url is%s :" % self.extract_volume.url)
try:
- formatted_url = urllib.unquote_plus(self.extract_volume.url)
+ formatted_url = urllib.parse.unquote_plus(self.extract_volume.url)
self.debug(
"Attempting to download volume at url %s" %
formatted_url)
- response = urllib.urlopen(formatted_url)
+ response = urllib.request.urlopen(formatted_url)
self.debug("response from volume url %s" % response.getcode())
fd, path = tempfile.mkstemp()
self.debug(
@@ -930,11 +931,11 @@ def test_02_negative_path(self):
self.debug("extracted url is%s :" % self.extract_volume.url)
try:
- formatted_url = urllib.unquote_plus(self.extract_volume.url)
+ formatted_url = urllib.parse.unquote_plus(self.extract_volume.url)
self.debug(
"Attempting to download volume at url %s" %
formatted_url)
- response = urllib.urlopen(formatted_url)
+ response = urllib.request.urlopen(formatted_url)
self.debug("response from volume url %s" % response.getcode())
fd, path = tempfile.mkstemp()
self.debug(
diff --git a/tools/apidoc/gen_toc.py b/tools/apidoc/gen_toc.py
index 0b0702ac86c0..066cf9f16b03 100644
--- a/tools/apidoc/gen_toc.py
+++ b/tools/apidoc/gen_toc.py
@@ -206,7 +206,7 @@
def choose_category(fn):
- for k, v in known_categories.items():
+ for k, v in list(known_categories.items()):
if k in fn:
return v
raise Exception('Need to add a category for %s to %s:known_categories' %
@@ -248,10 +248,10 @@ def choose_category(fn):
def xml_for(command):
name = command['name']
- async = command['async'] and ' (A)' or ''
+ asyncmethod = command['async'] and ' (A)' or ''
dirname = command['dirname']
return '''
-%(async)s
+%(asyncmethod)s
''' % locals()
@@ -260,7 +260,7 @@ def write_xml(out, user):
with open(out, 'w') as f:
cat_strings = []
- for category in categories.keys():
+ for category in list(categories.keys()):
strings = []
for command in categories[category]:
if command['user'] == user:
@@ -303,7 +303,7 @@ def java_for(command, user):
def java_for_user(user):
strings = []
- for category in categories.keys():
+ for category in list(categories.keys()):
for command in categories[category]:
if command['user'] == user:
strings.append(java_for(command, user))
diff --git a/tools/marvin/marvin/asyncJobMgr.py b/tools/marvin/marvin/asyncJobMgr.py
index 42fabad382fa..ca4b2b76b60e 100644
--- a/tools/marvin/marvin/asyncJobMgr.py
+++ b/tools/marvin/marvin/asyncJobMgr.py
@@ -18,10 +18,10 @@
import threading
from marvin import cloudstackException
import time
-import Queue
+import queue
import copy
import sys
-import jsonHelper
+from . import jsonHelper
import datetime
@@ -45,7 +45,7 @@ def __init__(self):
def __str__(self):
return '{%s}' % str(', '.join('%s : %s' % (k, repr(v)) for (k, v)
- in self.__dict__.iteritems()))
+ in self.__dict__.items()))
class workThread(threading.Thread):
@@ -157,9 +157,9 @@ def __init__(self):
class asyncJobMgr(object):
def __init__(self, apiClient, db):
- self.inqueue = Queue.Queue()
+ self.inqueue = queue.Queue()
self.output = outputDict()
- self.outqueue = Queue.Queue()
+ self.outqueue = queue.Queue()
self.apiClient = apiClient
self.db = db
@@ -196,7 +196,7 @@ def updateTimeStamp(self, jobstatus):
def waitForComplete(self, workers=10):
self.inqueue.join()
lock = threading.Lock()
- resultQueue = Queue.Queue()
+ resultQueue = queue.Queue()
'''intermediate result is stored in self.outqueue'''
for i in range(workers):
worker = workThread(self.outqueue, resultQueue, self.apiClient,
@@ -233,7 +233,7 @@ def submitJobExecuteNtimes(self, job, ntimes=1, nums_threads=1,
submit one job and execute the same job ntimes, with nums_threads
of threads
'''
- inqueue1 = Queue.Queue()
+ inqueue1 = queue.Queue()
lock = threading.Condition()
for i in range(ntimes):
newjob = copy.copy(job)
@@ -248,7 +248,7 @@ def submitJobExecuteNtimes(self, job, ntimes=1, nums_threads=1,
def submitJobs(self, jobs, nums_threads=1, interval=1):
'''submit n jobs, execute them with nums_threads of threads'''
- inqueue1 = Queue.Queue()
+ inqueue1 = queue.Queue()
lock = threading.Condition()
for job in jobs:
diff --git a/tools/marvin/marvin/cloudstackConnection.py b/tools/marvin/marvin/cloudstackConnection.py
index 826069742fe2..3f9a8b6f3307 100644
--- a/tools/marvin/marvin/cloudstackConnection.py
+++ b/tools/marvin/marvin/cloudstackConnection.py
@@ -16,13 +16,13 @@
# under the License.
import requests
-import urllib
+import urllib.request, urllib.parse, urllib.error
import base64
import hmac
import hashlib
import time
-from cloudstackAPI import queryAsyncJobResult
-import jsonHelper
+from .cloudstackAPI import queryAsyncJobResult
+from . import jsonHelper
from marvin.codes import (
FAILED,
JOB_FAILED,
@@ -137,18 +137,17 @@ def __sign(self, payload):
@Input: payload: dictionary of params be signed
@Output: the signature of the payload
"""
- params = zip(payload.keys(), payload.values())
+ params = list(zip(list(payload.keys()), list(payload.values())))
params.sort(key=lambda k: str.lower(k[0]))
hash_str = "&".join(
["=".join(
[str.lower(r[0]),
str.lower(
- urllib.quote_plus(str(r[1]), safe="*")
+ urllib.parse.quote_plus(str(r[1]), safe="*")
).replace("+", "%20")]
) for r in params]
)
- signature = base64.encodestring(hmac.new(
- self.securityKey, hash_str, hashlib.sha1).digest()).strip()
+ signature = base64.encodestring(hmac.new(self.securityKey.encode('utf-8'), hash_str.encode('utf-8'), hashlib.sha1).digest()).strip()
return signature
def __sendPostReqToCS(self, url, payload):
@@ -264,7 +263,7 @@ def __sanitizeCmd(self, cmd):
self.__lastError = InvalidParameterException(
"Invalid Parameters")
return FAILED
- for param, value in payload.items():
+ for param, value in list(payload.items()):
if value is None:
payload.pop(param)
elif param == 'typeInfo':
@@ -279,7 +278,7 @@ def __sanitizeCmd(self, cmd):
payload.pop(param)
i = 0
for val in value:
- for k, v in val.iteritems():
+ for k, v in val.items():
payload["%s[%d].%s" % (param, i, k)] = v
i += 1
return cmd_name.strip(), isAsync, payload
diff --git a/tools/marvin/marvin/cloudstackTestCase.py b/tools/marvin/marvin/cloudstackTestCase.py
index 4a57ae2fb72b..eb6c529bac9e 100644
--- a/tools/marvin/marvin/cloudstackTestCase.py
+++ b/tools/marvin/marvin/cloudstackTestCase.py
@@ -15,7 +15,7 @@
# specific language governing permissions and limitations
# under the License.
-import unittest
+import unittest2
from marvin.lib.utils import verifyElementInList, cleanup_resources
from marvin.codes import PASS
@@ -34,7 +34,7 @@ def __init__(self, *args, **kws):
return wrapper
-class cloudstackTestCase(unittest.case.TestCase):
+class cloudstackTestCase(unittest2.TestCase):
clstestclient = None
def assertElementInList(self, inp, toverify, responsevar=None, pos=0,
@@ -47,7 +47,7 @@ def assertElementInList(self, inp, toverify, responsevar=None, pos=0,
when failed
'''
out = verifyElementInList(inp, toverify, responsevar, pos)
- unittest.TestCase.assertEquals(out[0], PASS, "msg:%s" % out[1])
+ unittest.TestCase.assertEqual(out[0], PASS, "msg:%s" % out[1])
@classmethod
def getClsTestClient(cls):
diff --git a/tools/marvin/marvin/cloudstackTestClient.py b/tools/marvin/marvin/cloudstackTestClient.py
index 08b3f348c756..5add003202ad 100644
--- a/tools/marvin/marvin/cloudstackTestClient.py
+++ b/tools/marvin/marvin/cloudstackTestClient.py
@@ -115,8 +115,8 @@ def __setHypervisorInfo(self):
self.__hypervisor = XEN_SERVER
return SUCCESS
except Exception as e:
- print "\n Exception Occurred Under __setHypervisorInfo " \
- "%s" % GetDetailExceptionInfo(e)
+ print("\n Exception Occurred Under __setHypervisorInfo " \
+ "%s" % GetDetailExceptionInfo(e))
return FAILED
def __createApiClient(self):
diff --git a/tools/marvin/marvin/codegenerator.py b/tools/marvin/marvin/codegenerator.py
index f583d526de4a..0af72bc29ac6 100644
--- a/tools/marvin/marvin/codegenerator.py
+++ b/tools/marvin/marvin/codegenerator.py
@@ -21,7 +21,7 @@
from textwrap import dedent
import os
import sys
-import urllib2
+from urllib.request import urlopen
class cmdParameterProperty(object):
@@ -40,7 +40,7 @@ class cloudStackCmd(object):
def __init__(self):
self.name = ""
self.desc = ""
- self.async = "false"
+ self.asyncmethod = "false"
self.request = []
self.response = []
@@ -121,15 +121,15 @@ def generate(self, cmd):
self.code = self.license
self.code += self.newline
self.code += '"""%s"""\n' % self.cmd.desc
- self.code += 'from baseCmd import *\n'
- self.code += 'from baseResponse import *\n'
+ self.code += 'from .baseCmd import *\n'
+ self.code += 'from .baseResponse import *\n'
self.code += "class %sCmd (baseCmd):\n" % self.cmd.name
self.code += self.space
self.code += 'typeInfo = {}\n'
self.code += self.space + "def __init__(self):\n"
self.code += self.space + self.space
- self.code += 'self.isAsync = "%s"\n' % str(self.cmd.async).lower()
+ self.code += 'self.isAsync = "%s"\n' % str(self.cmd.asyncmethod).lower()
for req in self.cmd.request:
if req.desc is not None:
@@ -244,7 +244,7 @@ def finalize(self):
body += self.space + self.space + 'return response\n'
body += self.newline
- imports += 'from %s import %sResponse\n' % (cmdName, cmdName)
+ imports += 'from .%s import %sResponse\n' % (cmdName, cmdName)
initCmdsList += '"%s",' % cmdName
fp = open(self.outputFolder + '/cloudstackAPI/cloudstackAPIClient.py',
@@ -305,9 +305,9 @@ def loadCmdFromXML(self, dom):
if desc:
csCmd.desc = desc
- async = getText(cmd.getElementsByTagName('isAsync'))
- if async:
- csCmd.async = async
+ asyncmethod = getText(cmd.getElementsByTagName('isAsync'))
+ if asyncmethod:
+ csCmd.asyncmethod = asyncmethod
argList = cmd.getElementsByTagName("request")[0].\
getElementsByTagName("arg")
@@ -398,7 +398,7 @@ def loadCmdFromJSON(self, apiStream):
csCmd.desc = cmd['description']
if 'isasync' in cmd:
- csCmd.async = cmd['isasync']
+ csCmd.asyncmethod = cmd['isasync']
for param in cmd['params']:
paramProperty = cmdParameterProperty()
@@ -436,7 +436,7 @@ def generateCodeFromJSON(self, endpointUrl):
@return: The classes in cloudstackAPI/ formed from api discovery json
"""
if endpointUrl.find('response=json') >= 0:
- apiStream = urllib2.urlopen(endpointUrl)
+ apiStream = urlopen(endpointUrl)
cmds = self.loadCmdFromJSON(apiStream)
for cmd in cmds:
self.generate(cmd)
@@ -468,17 +468,16 @@ def getText(elements):
try:
os.mkdir(apiModule)
except:
- print "Failed to create folder %s, due to %s" % (apiModule,
- sys.exc_info())
- print parser.print_help()
+ print ("Failed to create folder {0}, due to {1}".format(apiModule, sys.exc_info()))
+ print (parser.print_help())
exit(2)
apiSpecFile = "/etc/cloud/cli/commands.xml"
if options.spec is not None:
apiSpecFile = options.spec
if not os.path.exists(apiSpecFile):
- print "the spec file %s does not exists" % apiSpecFile
- print parser.print_help()
+ print ("the spec file %s does not exists" % apiSpecFile)
+ print (parser.print_help())
exit(1)
cg = CodeGenerator(folder)
diff --git a/tools/marvin/marvin/configGenerator.py b/tools/marvin/marvin/configGenerator.py
index 6055f46723e4..ccf9db5a5c56 100644
--- a/tools/marvin/marvin/configGenerator.py
+++ b/tools/marvin/marvin/configGenerator.py
@@ -18,7 +18,7 @@
import json
import os
from optparse import OptionParser
-import jsonHelper
+from . import jsonHelper
from marvin.codes import *
from marvin.cloudstackException import GetDetailExceptionInfo
from marvin.config.test_data import test_data
@@ -96,12 +96,12 @@ class trafficType(object):
def __init__(self, typ, labeldict=None):
self.typ = typ # Guest/Management/Public
if labeldict:
- self.xen = labeldict['xen'] if 'xen' in labeldict.keys() else None
- self.kvm = labeldict['kvm'] if 'kvm' in labeldict.keys() else None
+ self.xen = labeldict['xen'] if 'xen' in list(labeldict.keys()) else None
+ self.kvm = labeldict['kvm'] if 'kvm' in list(labeldict.keys()) else None
self.vmware = labeldict['vmware']\
- if 'vmware' in labeldict.keys() else None
+ if 'vmware' in list(labeldict.keys()) else None
self.simulator = labeldict['simulator']\
- if 'simulator' in labeldict.keys() else None
+ if 'simulator' in list(labeldict.keys()) else None
class pod(object):
@@ -266,7 +266,7 @@ def getUrl(self):
return repr(self)
def __repr__(self):
- req = zip(self.__dict__.keys(), self.__dict__.values())
+ req = list(zip(list(self.__dict__.keys()), list(self.__dict__.values())))
return self.hostname + "?" + "&".join(["=".join([r[0], r[1]])
for r in req])
@@ -290,7 +290,7 @@ def getUrl(self):
return repr(self)
def __repr__(self):
- req = zip(self.__dict__.keys(), self.__dict__.values())
+ req = list(zip(list(self.__dict__.keys()), list(self.__dict__.values())))
return self.hostname + "?" + "&".join(["=".join([r[0], r[1]])
for r in req])
@@ -312,7 +312,7 @@ def getUrl(self):
return repr(self)
def __repr__(self):
- req = zip(self.__dict__.keys(), self.__dict__.values())
+ req = list(zip(list(self.__dict__.keys()), list(self.__dict__.values())))
return self.hostname + "?" + "&".join(["=".join([r[0], r[1]])
for r in req])
@@ -389,8 +389,8 @@ def __parseConfig(self):
config_dict = config
except Exception as e:
# Will replace with log once we have logging done
- print "\n Exception occurred under ConfigManager:__parseConfig" \
- " :%s", GetDetailExceptionInfo(e)
+ print("\n Exception occurred under ConfigManager:__parseConfig" \
+ " :%s", GetDetailExceptionInfo(e))
finally:
return config_dict
@@ -417,7 +417,7 @@ def getSectionData(self, section=None):
@Output:Section matching inside the parsed data
'''
if self.__parsedCfgDict is None or section is None:
- print "\nEither Parsed Dictionary is None or Section is None"
+ print("\nEither Parsed Dictionary is None or Section is None")
return INVALID_INPUT
if section is not None:
return self.__parsedCfgDict.get(section)
@@ -435,7 +435,7 @@ def getConfig(self):
def getDeviceUrl(obj):
- req = zip(obj.__dict__.keys(), obj.__dict__.values())
+ req = list(zip(list(obj.__dict__.keys()), list(obj.__dict__.values())))
if obj.hostname:
return "http://" + obj.hostname + "?" + "&".join(["=".join([r[0],
r[1]])
@@ -543,7 +543,7 @@ def descSetupInBasicMode():
'expunge.interval': '60',
'expunge.workers': '3',
}
- for k, v in global_settings.iteritems():
+ for k, v in global_settings.items():
cfg = configuration()
cfg.name = k
cfg.value = v
@@ -667,7 +667,7 @@ def descSetupInEipMode():
'expunge.interval': '60',
'expunge.workers': '3',
}
- for k, v in global_settings.iteritems():
+ for k, v in global_settings.items():
cfg = configuration()
cfg.name = k
cfg.value = v
@@ -788,7 +788,7 @@ def descSetupInAdvancedMode():
'expunge.interval': '60',
'expunge.workers': '3',
}
- for k, v in global_settings.iteritems():
+ for k, v in global_settings.items():
cfg = configuration()
cfg.name = k
cfg.value = v
@@ -900,7 +900,7 @@ def descSetupInAdvancedsgMode():
'expunge.interval': '60',
'expunge.workers': '3',
}
- for k, v in global_settings.iteritems():
+ for k, v in global_settings.items():
cfg = configuration()
cfg.name = k
cfg.value = v
@@ -931,8 +931,8 @@ def getSetupConfig(file):
config = json.loads("\n".join(configLines))
return jsonHelper.jsonLoader(config)
except Exception as e:
- print "\nException Occurred under getSetupConfig %s" % \
- GetDetailExceptionInfo(e)
+ print("\nException Occurred under getSetupConfig %s" % \
+ GetDetailExceptionInfo(e))
if __name__ == "__main__":
parser = OptionParser()
diff --git a/tools/marvin/marvin/dbConnection.py b/tools/marvin/marvin/dbConnection.py
index e7758a7cf46f..a3c19d737594 100644
--- a/tools/marvin/marvin/dbConnection.py
+++ b/tools/marvin/marvin/dbConnection.py
@@ -80,8 +80,8 @@ def executeSqlFromFile(self, fileName=None):
except cloudstackException.dbException, e:
print e
'''
- print db.execute("update vm_template set name='fjkd' where id=200")
+ print(db.execute("update vm_template set name='fjkd' where id=200"))
for i in range(10):
result = db.execute("select job_status, created, \
last_updated from async_job where id=%d" % i)
- print result
+ print(result)
diff --git a/tools/marvin/marvin/deployAndRun.py b/tools/marvin/marvin/deployAndRun.py
index 34dc4b671b02..7a52afcdc93c 100644
--- a/tools/marvin/marvin/deployAndRun.py
+++ b/tools/marvin/marvin/deployAndRun.py
@@ -44,11 +44,11 @@ def new_function(*args, **kwargs):
if original_func(*args, **kwargs) == FAILED:
exit_check = True
except Exception as e:
- print "===Exception.Please Check:===", e
+ print("===Exception.Please Check:===", e)
exit_check = True
finally:
if exit_check:
- print "==== %s ====" % self.msg
+ print("==== %s ====" % self.msg)
MarvinCliHelp.print_cmds_help()
sys.exit(1)
return new_function
@@ -135,12 +135,12 @@ class MarvinCliHelp(object):
@classmethod
def print_cmds_help(cls):
msg = ''
- for cmd_name, cmd_txt in MarvinCliCommands.cmds_info.items():
+ for cmd_name, cmd_txt in list(MarvinCliCommands.cmds_info.items()):
msg = msg + \
'\n----------------------------------------------------\n'
cmd_info = ShellColor.BOLD + ShellColor.RED + \
'cmd_name:%s' % str(cmd_name) + ShellColor.END
- for key, value in cmd_txt.iteritems():
+ for key, value in cmd_txt.items():
cmd_info = cmd_info + '\n' + \
str(key) + ' : ' + str(value).strip('\n')
msg = msg + cmd_info
@@ -199,7 +199,7 @@ def parse_input_deploy(self, inputs=None):
self.__configFile = out_dict.get('config-file', '')
if not self.__configFile:
return FAILED
- print "\n==== Parsing Input Options Successful ===="
+ print("\n==== Parsing Input Options Successful ====")
return SUCCESS
return FAILED
@@ -222,7 +222,7 @@ def parse_input_runtcs(self, inputs):
self.__requiredHw = out_dict.get("required-hardware")
if not all([self.__tcPath, self.__configFile]):
return FAILED
- print "\n==== Parsing Input Options Successful ===="
+ print("\n==== Parsing Input Options Successful ====")
return SUCCESS
return FAILED
@@ -246,12 +246,12 @@ def start_marvin(self):
return SUCCESS
return FAILED
except Exception as e:
- print "====Exception Occurred under start_marvin: %s ====" % \
- GetDetailExceptionInfo(e)
+ print("====Exception Occurred under start_marvin: %s ====" % \
+ GetDetailExceptionInfo(e))
return FAILED
def run_test_suites(self):
- print "\n==== Started Running Test Cases ===="
+ print("\n==== Started Running Test Cases ====")
xunit_out_path = "/tmp/marvin_xunit_out" + \
str(random.randrange(1, 10000)) + ".xml"
marvin_tc_run_cmd = "nosetests-2.7 -s --with-marvin --marvin-config=%s --with-xunit --xunit-file=%s %s -a tags=advanced, required_hardware=%s --zone=%s --hypervisor=%s"
@@ -272,7 +272,7 @@ def run_test_suites(self):
engine.loadTestsFromDir(self.__tcPath)
engine.run()
'''
- print "\n==== Running Test Cases Successful ===="
+ print("\n==== Running Test Cases Successful ====")
@VerifyAndExit(
"cmd failed, may be invalid input options, please check help")
@@ -283,7 +283,7 @@ def do_deploydc(self, args):
self.start_marvin()
return SUCCESS
except Exception as e:
- print "==== deploy cmd failed :%s ==== " % str(e)
+ print("==== deploy cmd failed :%s ==== " % str(e))
return FAILED
@VerifyAndExit(
@@ -295,7 +295,7 @@ def do_deploydc_and_runtest(self, args):
self.run_test_suites()
return SUCCESS
except Exception as e:
- print "==== deploydc cmd failed:%s ==== " % str(e)
+ print("==== deploydc cmd failed:%s ==== " % str(e))
return FAILED
@VerifyAndExit(
@@ -311,7 +311,7 @@ def do_generateapis_from_apispecfile(self, args):
if os.path.exists(value):
api_spec_file = value
elif not os.path.exists(api_spec_file):
- print "=== Mentioned api spec file :%s does not exists ===" % str(api_spec_file)
+ print("=== Mentioned api spec file :%s does not exists ===" % str(api_spec_file))
sys.exit(1)
if key.lower() == 'cs-folder-path':
cs_api_folder = self.create_marvin_api_folder(value)
@@ -321,7 +321,7 @@ def do_generateapis_from_apispecfile(self, args):
cg.generateCodeFromXML(api_spec_file)
return SUCCESS
except Exception as e:
- print "==== Generating apis from api spec file failed: %s ====" % str(e.message())
+ print("==== Generating apis from api spec file failed: %s ====" % str(e.message()))
return FAILED
return FAILED
@@ -354,7 +354,7 @@ def do_generateapis_from_endpoint(self, args):
cg.generateCodeFromJSON(endpoint_url)
return SUCCESS
except Exception as e:
- print "==== Generating apis from end point failed: %s ====" % str(e.message())
+ print("==== Generating apis from end point failed: %s ====" % str(e.message()))
return FAILED
return FAILED
@@ -367,7 +367,7 @@ def do_runtest(self, args):
self.run_test_suites()
return SUCCESS
except Exception as e:
- print "==== run test failed: %s ====" % str(e.message())
+ print("==== run test failed: %s ====" % str(e.message()))
return FAILED
def install_marvin(self):
@@ -375,9 +375,9 @@ def install_marvin(self):
marvin_setup_file_path = self.__csFolder + "/tools/marvin/setup.py"
try:
os.system("python %s install" % str(marvin_setup_file_path))
- print "==== Marvin Installed Successfully ===="
+ print("==== Marvin Installed Successfully ====")
except Exception as e:
- print "==== Marvin Installation Failed ===="
+ print("==== Marvin Installation Failed ====")
@VerifyAndExit(
"cmd failed, may be invalid input options, please check help")
@@ -387,7 +387,7 @@ def do_build_and_install(self, args):
self.install_marvin()
return SUCCESS
except Exception as e:
- print "==== build from end point and install marvin failed: %s ====" % str(e)
+ print("==== build from end point and install marvin failed: %s ====" % str(e))
return FAILED
@VerifyAndExit(
@@ -398,7 +398,7 @@ def do_sync_and_install(self, args):
self.install_marvin()
return SUCCESS
except Exception as e:
- print "==== sync from spec file and install marvin failed: %s ====" % str(e)
+ print("==== sync from spec file and install marvin failed: %s ====" % str(e))
return FAILED
@@ -427,12 +427,12 @@ def main():
MarvinCliHelp.help_printversion()
sys.exit(0)
if len(sys.argv) > 1:
- if sys.argv[1].lower() not in MarvinCliCommands.cmds_info.keys():
- print "\n==== Invalid Command ===="
+ if sys.argv[1].lower() not in list(MarvinCliCommands.cmds_info.keys()):
+ print("\n==== Invalid Command ====")
sys.exit(1)
args = ' '.join(args)
if '-h' in args or '--help' in args:
- print MarvinCliCommands.cmds_info[sys.argv[0]]
+ print(MarvinCliCommands.cmds_info[sys.argv[0]])
else:
MarvinCli().onecmd(args)
sys.exit(0)
diff --git a/tools/marvin/marvin/deployDataCenter.py b/tools/marvin/marvin/deployDataCenter.py
index 1b6365a355d6..c3e8511141f4 100644
--- a/tools/marvin/marvin/deployDataCenter.py
+++ b/tools/marvin/marvin/deployDataCenter.py
@@ -74,17 +74,17 @@ def __persistDcConfig(self):
file_to_write = open(dc_file_path, 'w')
if file_to_write:
pickle.dump(self.__cleanUp, file_to_write)
- print "\n=== Data Center Settings are dumped to %s===" % dc_file_path
+ print("\n=== Data Center Settings are dumped to %s===" % dc_file_path)
self.__tcRunLogger.debug("\n=== Data Center Settings are dumped to %s===" % dc_file_path)
except Exception as e:
- print "Exception Occurred while persisting DC Settings: %s" % \
- GetDetailExceptionInfo(e)
+ print("Exception Occurred while persisting DC Settings: %s" % \
+ GetDetailExceptionInfo(e))
def __cleanAndExit(self):
try:
- print "\n===deploy dc failed, so cleaning the created entries==="
+ print("\n===deploy dc failed, so cleaning the created entries===")
if not test_data.get("deleteDC", None):
- print "\n=== Deploy DC Clean Up flag not set. So, exiting ==="
+ print("\n=== Deploy DC Clean Up flag not set. So, exiting ===")
exit(1)
self.__tcRunLogger.debug(
"===Deploy DC Failed, So Cleaning to Exit===")
@@ -94,30 +94,30 @@ def __cleanAndExit(self):
)
if remove_dc_obj:
if remove_dc_obj.removeDataCenter() == FAILED:
- print "\n===Removing DataCenter Failed==="
+ print("\n===Removing DataCenter Failed===")
self.__tcRunLogger.debug(
"===Removing DataCenter Failed===")
else:
- print "\n===Removing DataCenter Successful==="
+ print("\n===Removing DataCenter Successful===")
self.__tcRunLogger.debug(
"===Removing DataCenter Successful===")
exit(1)
except Exception as e:
- print "Exception Occurred during DC CleanUp: %s" % \
- GetDetailExceptionInfo(e)
+ print("Exception Occurred during DC CleanUp: %s" % \
+ GetDetailExceptionInfo(e))
def __addToCleanUp(self, type, id):
- if type not in self.__cleanUp.keys():
+ if type not in list(self.__cleanUp.keys()):
self.__cleanUp[type] = []
self.__cleanUp[type].append(id)
- if "order" not in self.__cleanUp.keys():
+ if "order" not in list(self.__cleanUp.keys()):
self.__cleanUp["order"] = []
if type not in self.__cleanUp["order"]:
self.__cleanUp["order"].append(type)
def addHosts(self, hosts, zoneId, podId, clusterId, hypervisor):
if hosts is None:
- print "\n === Invalid Hosts Information ===="
+ print("\n === Invalid Hosts Information ====")
return
failed_cnt = 0
for host in hosts:
@@ -144,7 +144,7 @@ def addHosts(self, hosts, zoneId, podId, clusterId, hypervisor):
self.__addToCleanUp("Host", ret[0].id)
except Exception as e:
failed_cnt = failed_cnt + 1
- print "Exception Occurred :%s" % GetDetailExceptionInfo(e)
+ print("Exception Occurred :%s" % GetDetailExceptionInfo(e))
self.__tcRunLogger.exception(
"=== Adding Host Failed :%s===" % str(
host.url))
@@ -165,7 +165,7 @@ def addVmWareDataCenter(self, vmwareDc):
self.__tcRunLogger.debug("=== Adding VmWare DC Successful===")
self.__addToCleanUp("VmwareDc", ret.id)
except Exception as e:
- print "Exception Occurred: %s" % GetDetailExceptionInfo(e)
+ print("Exception Occurred: %s" % GetDetailExceptionInfo(e))
self.__tcRunLogger.exception("=== Adding VmWare DC Failed===")
self.__cleanAndExit()
@@ -184,7 +184,7 @@ def addBaremetalRct(self, config):
self.__tcRunLogger.debug("=== Adding Baremetal Rct file Successful===")
self.__addToCleanUp("BaremetalRct", ret.id)
except Exception as e:
- print "Exception Occurred: %s" % GetDetailExceptionInfo(e)
+ print("Exception Occurred: %s" % GetDetailExceptionInfo(e))
self.__tcRunLogger.exception("=== Adding Baremetal Rct file Failed===")
self.__cleanAndExit()
@@ -224,7 +224,7 @@ def createClusters(self, clusters, zoneId, podId, vmwareDc=None):
clusterId)
except Exception as e:
- print "Exception Occurred %s" % GetDetailExceptionInfo(e)
+ print("Exception Occurred %s" % GetDetailExceptionInfo(e))
self.__tcRunLogger.exception("====Cluster %s Creation Failed"
"=====" %
str(cluster.clustername))
@@ -247,8 +247,8 @@ def waitForHost(self, zoneId, clusterId):
sleep(timeout)
retry = retry - 1
except Exception as e:
- print "\nException Occurred:%s" %\
- GetDetailExceptionInfo(e)
+ print("\nException Occurred:%s" %\
+ GetDetailExceptionInfo(e))
self.__tcRunLogger.exception("=== List Hosts Failed===")
self.__cleanAndExit()
@@ -263,7 +263,7 @@ def createPrimaryStorages(self,
for primary in primaryStorages:
primarycmd = createStoragePool.createStoragePoolCmd()
if primary.details:
- for key, value in vars(primary.details).iteritems():
+ for key, value in vars(primary.details).items():
primarycmd.details.append({ key: value})
primarycmd.name = primary.name
@@ -283,7 +283,7 @@ def createPrimaryStorages(self,
"=== Creating Storage Pool Successful===")
self.__addToCleanUp("StoragePool", ret.id)
except Exception as e:
- print "Exception Occurred: %s" % GetDetailExceptionInfo(e)
+ print("Exception Occurred: %s" % GetDetailExceptionInfo(e))
self.__tcRunLogger.\
exception("=== Create Storage Pool Failed===")
self.__cleanAndExit()
@@ -316,7 +316,7 @@ def createPods(self,
self.createClusters(pod.clusters, zoneId, podId,
vmwareDc=pod.vmwaredc)
except Exception as e:
- print "Exception Occurred: %s" % GetDetailExceptionInfo(e)
+ print("Exception Occurred: %s" % GetDetailExceptionInfo(e))
self.__tcRunLogger.\
exception("====Pod: %s Creation "
"Failed=====" % str(pod.name))
@@ -352,7 +352,7 @@ def createVlanIpRanges(self, mode, ipranges, zoneId, podId=None,
"=== Creating Vlan Ip Range Successful===")
self.__addToCleanUp("VlanIpRange", ret.id)
except Exception as e:
- print "Exception Occurred: %s" % GetDetailExceptionInfo(e)
+ print("Exception Occurred: %s" % GetDetailExceptionInfo(e))
self.__tcRunLogger.\
exception("=== Create Vlan Ip Range Failed===")
self.__cleanAndExit()
@@ -368,7 +368,7 @@ def createSecondaryStorages(self, secondaryStorages, zoneId):
secondarycmd.details = []
if secondarycmd.provider.lower() in ('s3', "swift", "smb"):
- for key, value in vars(secondary.details).iteritems():
+ for key, value in vars(secondary.details).items():
secondarycmd.details.append({
'key': key,
'value': value
@@ -381,7 +381,7 @@ def createSecondaryStorages(self, secondaryStorages, zoneId):
"===Add Image Store Successful===")
self.__addToCleanUp("ImageStore", ret.id)
except Exception as e:
- print "Exception Occurred: %s" % GetDetailExceptionInfo(e)
+ print("Exception Occurred: %s" % GetDetailExceptionInfo(e))
self.__tcRunLogger.\
exception("=== Add Image Store Failed===")
self.__cleanAndExit()
@@ -399,7 +399,7 @@ def createCacheStorages(self, cacheStorages, zoneId):
cachecmd.details = []
if cache.details:
- for key, value in vars(cache.details).iteritems():
+ for key, value in vars(cache.details).items():
cachecmd.details.append({
'key': key,
'value': value
@@ -410,7 +410,7 @@ def createCacheStorages(self, cacheStorages, zoneId):
"===Creating Secondary StagingStore Successful===")
self.__addToCleanUp("SecondaryStagingStore", ret.id)
except Exception as e:
- print "Exception Occurred: %s" % GetDetailExceptionInfo(e)
+ print("Exception Occurred: %s" % GetDetailExceptionInfo(e))
self.__tcRunLogger.\
exception("=== Creating "
"SecondaryStagingStorage Failed===")
@@ -443,7 +443,7 @@ def createNetworks(self, networks, zoneId):
self.__addToCleanUp("Network", networkId)
return networkId
except Exception as e:
- print "Exception Occurred %s" % GetDetailExceptionInfo(e)
+ print("Exception Occurred %s" % GetDetailExceptionInfo(e))
self.__tcRunLogger.\
exception("====Network : %s "
"Creation Failed=====" % str(network.name))
@@ -468,7 +468,7 @@ def createPhysicalNetwork(self, net, zoneid):
self.addTrafficTypes(phynetwrk.id, net.traffictypes)
return phynetwrk
except Exception as e:
- print "Exception Occurred: %s" % GetDetailExceptionInfo(e)
+ print("Exception Occurred: %s" % GetDetailExceptionInfo(e))
self.__tcRunLogger.exception("====Physical Network "
"Creation Failed=====")
self.__cleanAndExit()
@@ -484,7 +484,7 @@ def updatePhysicalNetwork(self, networkid, state="Enabled",
ret = self.__apiClient.updatePhysicalNetwork(upnet)
return ret
except Exception as e:
- print "Exception Occurred: %s" % GetDetailExceptionInfo(e)
+ print("Exception Occurred: %s" % GetDetailExceptionInfo(e))
self.__tcRunLogger.\
exception("====Update Physical Network Failed=====")
self.__cleanAndExit()
@@ -500,7 +500,7 @@ def enableProvider(self, provider_id):
self.__tcRunLogger.debug(
"===Update Network Service Provider Successfull===")
except Exception as e:
- print "Exception Occurred: %s" % GetDetailExceptionInfo(e)
+ print("Exception Occurred: %s" % GetDetailExceptionInfo(e))
self.__tcRunLogger.\
exception(
"====Update Network Service Provider Failed=====")
@@ -640,7 +640,7 @@ def configureProviders(self, phynetwrk, providers):
"type" % device)
self.enableProvider(result.id)
except Exception as e:
- print "Exception Occurred: %s" % GetDetailExceptionInfo(e)
+ print("Exception Occurred: %s" % GetDetailExceptionInfo(e))
self.__tcRunLogger.\
exception("====List Network "
"Service Providers Failed=====")
@@ -669,7 +669,7 @@ def addTrafficType(self, physical_network_id, traffictype):
self.__addToCleanUp("TrafficType", ret.id)
return ret
except Exception as e:
- print "Exception Occurred: %s" % GetDetailExceptionInfo(e)
+ print("Exception Occurred: %s" % GetDetailExceptionInfo(e))
self.__tcRunLogger.\
exception("==== Add TrafficType Failed=====")
self.__cleanAndExit()
@@ -684,7 +684,7 @@ def enableZone(self, zoneid, allocation_state="Enabled"):
self.__tcRunLogger.debug("==== Enable Zone SuccessFul=====")
return ret
except Exception as e:
- print "Exception Occurred: %s" % GetDetailExceptionInfo(e)
+ print("Exception Occurred: %s" % GetDetailExceptionInfo(e))
self.__tcRunLogger.exception("==== Enable Zone Failed=====")
self.__cleanAndExit()
@@ -698,7 +698,7 @@ def updateZoneDetails(self, zoneid, details):
self.__tcRunLogger.debug("=== Update Zone SuccessFul===")
return ret
except Exception as e:
- print "Exception Occurred: %s" % GetDetailExceptionInfo(e)
+ print("Exception Occurred: %s" % GetDetailExceptionInfo(e))
self.__tcRunLogger.exception("==== Update Zone Failed=====")
self.__cleanAndExit()
@@ -715,18 +715,18 @@ def createZone(self, zone, rec=0):
self.__tcRunLogger.\
exception("====Zone : %s Creation Failed=====" %
str(zone.name))
- print "\n====Zone : %s Creation Failed=====" % str(zone.name)
+ print("\n====Zone : %s Creation Failed=====" % str(zone.name))
if not rec:
zone.name = zone.name + "_" + random_gen()
self.__tcRunLogger.\
debug("====Recreating Zone With New Name : "
"%s" % zone.name)
- print "\n====Recreating Zone With New Name ====", \
- str(zone.name)
+ print("\n====Recreating Zone With New Name ====", \
+ str(zone.name))
return self.createZone(zone, 1)
except Exception as e:
- print "\nException Occurred under createZone : %s" % \
- GetDetailExceptionInfo(e)
+ print("\nException Occurred under createZone : %s" % \
+ GetDetailExceptionInfo(e))
self.__tcRunLogger.exception("====Create Zone Failed ===")
return FAILED
@@ -762,10 +762,8 @@ def createZones(self, zones):
listNetworkOfferings.listNetworkOfferingsCmd()
listnetworkoffering.name =\
"DefaultSharedNetscalerEIPandELBNetworkOffering" \
- if len(filter(lambda x:
- x.typ == 'Public',
- zone.physical_networks[0].
- traffictypes)) > 0 \
+ if len([x for x in zone.physical_networks[0].
+ traffictypes if x.typ == 'Public']) > 0 \
else "DefaultSharedNetworkOfferingWithSGService"
if zone.networkofferingname is not None:
listnetworkoffering.name = zone.networkofferingname
@@ -840,13 +838,12 @@ def createZones(self, zones):
self.updateZoneDetails(zoneId, det)
return
except Exception as e:
- print "\nException Occurred %s" % GetDetailExceptionInfo(e)
+ print("\nException Occurred %s" % GetDetailExceptionInfo(e))
self.__tcRunLogger.exception("==== Create Zones Failed ===")
def isEipElbZone(self, zone):
if (zone.networktype == "Basic"
- and len(filter(lambda x: x.typ == 'Public',
- zone.physical_networks[0].traffictypes)) > 0):
+ and len([x for x in zone.physical_networks[0].traffictypes if x.typ == 'Public']) > 0):
return True
return False
@@ -870,15 +867,15 @@ def updateConfiguration(self, globalCfg):
self.__tcRunLogger.debug(
"==UpdateConfiguration Successfull===")
except Exception as e:
- print "Exception Occurred %s" % GetDetailExceptionInfo(e)
+ print("Exception Occurred %s" % GetDetailExceptionInfo(e))
self.__tcRunLogger.\
exception("===UpdateConfiguration Failed===")
self.__cleanAndExit()
def copyAttributesToCommand(self, source, command):
- map(lambda attr: setattr(command, attr, getattr(source, attr, None)),
- filter(lambda attr: not attr.startswith("__") and attr not in
- ["required", "isAsync"], dir(command)))
+ list(map(lambda attr: setattr(command, attr, getattr(source, attr, None)),
+ [attr for attr in dir(command) if not attr.startswith("__") and attr not in
+ ["required", "isAsync"]]))
def configureS3(self, s3):
try:
@@ -896,7 +893,7 @@ def configureS3(self, s3):
def deploy(self):
try:
- print "\n==== Deploy DC Started ===="
+ print("\n==== Deploy DC Started ====")
self.__tcRunLogger.debug("\n==== Deploy DC Started ====")
'''
Step1 : Set the Client
@@ -915,7 +912,7 @@ def deploy(self):
Persist the Configuration to an external file post DC creation
'''
self.__persistDcConfig()
- print "\n====Deploy DC Successful====="
+ print("\n====Deploy DC Successful=====")
self.__tcRunLogger.debug("\n====Deploy DC Successful====")
'''
Upload baremetalSwitch configuration(.rct) file if enabled zone has baremetal isolated network.
@@ -925,10 +922,10 @@ def deploy(self):
return SUCCESS
except Exception as e:
- print "\nException Occurred Under deploy :%s" % \
- GetDetailExceptionInfo(e)
+ print("\nException Occurred Under deploy :%s" % \
+ GetDetailExceptionInfo(e))
self.__tcRunLogger.debug("\n====Deploy DC Failed====")
- print "\n====Deploy DC Failed===="
+ print("\n====Deploy DC Failed====")
self.__cleanAndExit()
return FAILED
@@ -982,7 +979,7 @@ def __deleteCmds(self, cmd_name, cmd_obj):
list_host_cmd = listHosts.listHostsCmd()
list_host_cmd.id = cmd_obj.id
retries = 3
- for i in xrange(retries):
+ for i in range(retries):
list_host_resp = self.__apiClient.\
listHosts(list_host_cmd)
if (list_host_resp) and\
@@ -1000,7 +997,7 @@ def __deleteCmds(self, cmd_name, cmd_obj):
list_store_cmd = listStoragePools.listStoragePoolsCmd()
list_store_cmd.id = cmd_obj.id
retries = 3
- for i in xrange(retries):
+ for i in range(retries):
store_maint_resp = self.__apiClient.\
listStoragePools(list_store_cmd)
if (store_maint_resp) and \
@@ -1023,9 +1020,9 @@ def __cleanEntries(self):
'''
try:
ret = FAILED
- if "order" in self.__dcCfg.keys() and len(self.__dcCfg["order"]):
+ if "order" in list(self.__dcCfg.keys()) and len(self.__dcCfg["order"]):
self.__dcCfg["order"].reverse()
- print "\n====Clean Up Entries===", self.__dcCfg
+ print("\n====Clean Up Entries===", self.__dcCfg)
for type in self.__dcCfg["order"]:
self.__tcRunLogger.debug(
"====CleanUp Started For Type: %s====" %
@@ -1059,8 +1056,8 @@ def __cleanEntries(self):
(type, id))
ret = SUCCESS
except Exception as e:
- print "\n==== Exception Under __cleanEntries: %s ==== % " \
- % GetDetailExceptionInfo(e)
+ print("\n==== Exception Under __cleanEntries: %s ==== % " \
+ % GetDetailExceptionInfo(e))
self.__tcRunLogger.exception(
"\n==== Exception Under __cleanEntries: %s ==== % " %
GetDetailExceptionInfo(e))
@@ -1077,7 +1074,7 @@ def removeDataCenter(self):
try:
self.__setClient()
self.__tcRunLogger.debug("====DeployDC: CleanUp Started====")
- print "\n====DeployDC: CleanUp Started===="
+ print("\n====DeployDC: CleanUp Started====")
ret = FAILED
if self.__dcCfgFile:
file_to_read = open(self.__dcCfgFile, 'r')
@@ -1086,8 +1083,8 @@ def removeDataCenter(self):
if self.__dcCfg:
ret = self.__cleanEntries()
except Exception as e:
- print "\n==== Exception Under removeDataCenter: %s ====" % \
- GetDetailExceptionInfo(e)
+ print("\n==== Exception Under removeDataCenter: %s ====" % \
+ GetDetailExceptionInfo(e))
self.__tcRunLogger.exception(
"===DeployDC CleanUp FAILED: %s ====" %
GetDetailExceptionInfo(e))
@@ -1132,8 +1129,8 @@ def mkdirpath(path):
Verify the input validity
'''
if options.input is None and options.remove is None:
- print "\n==== For DeployDataCenter: Please Specify a valid Input Configuration File===="
- print "\n==== For DeleteDataCenters: Please Specify a valid Input Configuration File and DC Settings===="
+ print("\n==== For DeployDataCenter: Please Specify a valid Input Configuration File====")
+ print("\n==== For DeleteDataCenters: Please Specify a valid Input Configuration File and DC Settings====")
exit(1)
'''
@@ -1146,7 +1143,7 @@ def mkdirpath(path):
Step1: Create the Logger
'''
if (options.input) and not (os.path.isfile(options.input)):
- print "\n=== Invalid Input Config File Path, Please Check ==="
+ print("\n=== Invalid Input Config File Path, Please Check ===")
exit(1)
log_obj = MarvinLog("CSLog")
@@ -1161,7 +1158,7 @@ def mkdirpath(path):
log_folder_path = log_obj.getLogFolderPath()
tc_run_logger = log_obj.getLogger()
else:
- print "\n===Log Creation Failed. Please Check==="
+ print("\n===Log Creation Failed. Please Check===")
exit(1)
'''
@@ -1170,7 +1167,7 @@ def mkdirpath(path):
obj_tc_client = CSTestClient(cfg.mgtSvr[0], cfg.dbSvr,
logger=tc_run_logger)
if obj_tc_client and obj_tc_client.createTestClient() == FAILED:
- print "\n=== TestClient Creation Failed==="
+ print("\n=== TestClient Creation Failed===")
exit(1)
'''
@@ -1187,7 +1184,7 @@ def mkdirpath(path):
tc_run_logger,
log_folder_path=log_folder_path)
if deploy.deploy() == FAILED:
- print "\n===Deploy Failed==="
+ print("\n===Deploy Failed===")
tc_run_logger.debug("\n===Deploy Failed===");
exit(1)
@@ -1202,11 +1199,11 @@ def mkdirpath(path):
)
if remove_dc_obj:
if remove_dc_obj.removeDataCenter() == FAILED:
- print "\n===Removing DataCenter Failed==="
+ print("\n===Removing DataCenter Failed===")
tc_run_logger.debug("\n===Removing DataCenter Failed===")
exit(1)
else:
- print "\n===Removing DataCenter Successful==="
+ print("\n===Removing DataCenter Successful===")
tc_run_logger.debug("\n===Removing DataCenter Successful===")
# All OK exit with 0 exitcode
diff --git a/tools/marvin/marvin/jsonHelper.py b/tools/marvin/marvin/jsonHelper.py
index 2cd342f615bf..d2a6e5d11e15 100644
--- a/tools/marvin/marvin/jsonHelper.py
+++ b/tools/marvin/marvin/jsonHelper.py
@@ -14,7 +14,7 @@
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
-import cloudstackException
+from . import cloudstackException
import json
import inspect
from marvin.cloudstackAPI import *
@@ -51,11 +51,11 @@ def __getitem__(self, val):
def __repr__(self):
return '{%s}' % str(', '.join('%s : %s' % (k, repr(v)) for (k, v)
- in self.__dict__.iteritems()))
+ in self.__dict__.items()))
def __str__(self):
return '{%s}' % str(', '.join('%s : %s' % (k, repr(v)) for (k, v)
- in self.__dict__.iteritems()))
+ in self.__dict__.items()))
class jsonDump(object):
@@ -63,7 +63,7 @@ class jsonDump(object):
@staticmethod
def __serialize(obj):
"""Recursively walk object's hierarchy."""
- if isinstance(obj, (bool, int, long, float, basestring)):
+ if isinstance(obj, (bool, int, float, str)):
return obj
elif isinstance(obj, dict):
obj = obj.copy()
@@ -115,18 +115,18 @@ def finalizeResultObj(result, responseName, responsecls):
responsecls)
return result
elif responsecls is not None:
- for k, v in result.__dict__.iteritems():
+ for k, v in result.__dict__.items():
if k in responsecls.__dict__:
return result
- attr = result.__dict__.keys()[0]
+ attr = list(result.__dict__.keys())[0]
value = getattr(result, attr)
if not isinstance(value, jsonLoader):
return result
findObj = False
- for k, v in value.__dict__.iteritems():
+ for k, v in value.__dict__.items():
if k in responsecls.__dict__:
findObj = True
break
@@ -141,8 +141,7 @@ def finalizeResultObj(result, responseName, responsecls):
def getResultObj(returnObj, responsecls=None):
if len(returnObj) == 0:
return None
- responseName = filter(lambda a: a != u'cloudstack-version',
- returnObj.keys())[0]
+ responseName = [a for a in list(returnObj.keys()) if a != 'cloudstack-version'][0]
response = returnObj[responseName]
if len(response) == 0:
@@ -156,7 +155,7 @@ def getResultObj(returnObj, responsecls=None):
raise cloudstackException.CloudstackAPIException(respname, errMsg)
if result.count is not None:
- for key in result.__dict__.iterkeys():
+ for key in result.__dict__.keys():
if key == "count":
continue
else:
@@ -186,7 +185,7 @@ def getResultObj(returnObj, responsecls=None):
} ]
} }'''
nsp = getResultObj(result)
- print nsp[0].id
+ print(nsp[0].id)
result = '''{ "listzonesresponse" : {
"count" : 1,
@@ -205,7 +204,7 @@ def getResultObj(returnObj, responsecls=None):
}
}'''
zones = getResultObj(result)
- print zones[0].id
+ print(zones[0].id)
res = authorizeSecurityGroupIngress.authorizeSecurityGroupIngressResponse()
result = '''{
"queryasyncjobresultresponse" : {
@@ -242,8 +241,8 @@ def getResultObj(returnObj, responsecls=None):
}
}'''
asynJob = getResultObj(result, res)
- print asynJob.jobid, repr(asynJob.jobresult)
- print asynJob.jobresult.ingressrule[0].account
+ print(asynJob.jobid, repr(asynJob.jobresult))
+ print(asynJob.jobresult.ingressrule[0].account)
result = '''{
"queryasyncjobresultresponse" : {
@@ -256,15 +255,15 @@ def getResultObj(returnObj, responsecls=None):
try:
asynJob = getResultObj(result)
except cloudstackException.CloudstackAPIException as e:
- print e
+ print(e)
result = '{ "queryasyncjobresultresponse" : {} }'
asynJob = getResultObj(result)
- print asynJob
+ print(asynJob)
result = '{}'
asynJob = getResultObj(result)
- print asynJob
+ print(asynJob)
result = '''{
"createzoneresponse" : {
@@ -280,15 +279,15 @@ def getResultObj(returnObj, responsecls=None):
}'''
res = createZone.createZoneResponse()
zone = getResultObj(result, res)
- print zone.id
+ print(zone.id)
result = '{ "attachvolumeresponse" : {"jobid":24} }'
res = attachVolume.attachVolumeResponse()
res = getResultObj(result, res)
- print res
+ print(res)
result = '{ "listtemplatesresponse" : { } }'
- print getResultObj(result, listTemplates.listTemplatesResponse())
+ print(getResultObj(result, listTemplates.listTemplatesResponse()))
result = '''{
"queryasyncjobresultresponse" : {
@@ -300,7 +299,7 @@ def getResultObj(returnObj, responsecls=None):
}
}
}'''
- print getResultObj(result, listTemplates.listTemplatesResponse())
+ print(getResultObj(result, listTemplates.listTemplatesResponse()))
result = '''{
"queryasyncjobresultresponse" : {
"jobid":41,"jobstatus":1,"jobprocstatus":0,
@@ -381,9 +380,9 @@ def getResultObj(returnObj, responsecls=None):
}'''
vm = getResultObj(result,
deployVirtualMachine.deployVirtualMachineResponse())
- print vm.jobresult.id
+ print(vm.jobresult.id)
cmd = deployVirtualMachine.deployVirtualMachineCmd()
responsename = cmd.__class__.__name__.replace("Cmd", "Response")
response = getclassFromName(cmd, responsename)
- print response.id
+ print(response.id)
diff --git a/tools/marvin/marvin/lib/base.py b/tools/marvin/marvin/lib/base.py
index 6bb7b669096c..162e70d1257d 100755
--- a/tools/marvin/marvin/lib/base.py
+++ b/tools/marvin/marvin/lib/base.py
@@ -85,8 +85,8 @@ def delete(self, apiclient, cleanup=None):
def list(cls, apiclient, **kwargs):
"""Lists domains"""
cmd = listDomains.listDomainsCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
- if 'account' in kwargs.keys() and 'domainid' in kwargs.keys():
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
+ if 'account' in list(kwargs.keys()) and 'domainid' in list(kwargs.keys()):
cmd.listall = True
return (apiclient.listDomains(cmd))
@@ -137,7 +137,7 @@ def update(self, apiclient, **kwargs):
cmd = updateRole.updateRoleCmd()
cmd.id = self.id
- [setattr(cmd, k, v) for k, v in kwargs.items()]
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
return apiclient.updateRole(cmd)
@classmethod
@@ -145,7 +145,7 @@ def list(cls, apiclient, **kwargs):
"""List all Roles matching criteria"""
cmd = listRoles.listRolesCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
return (apiclient.listRoles(cmd))
@@ -179,7 +179,7 @@ def update(self, apiclient, **kwargs):
cmd = updateRolePermission.updateRolePermissionCmd()
cmd.roleid = self.roleid
- [setattr(cmd, k, v) for k, v in kwargs.items()]
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
return apiclient.updateRolePermission(cmd)
@classmethod
@@ -187,7 +187,7 @@ def list(cls, apiclient, **kwargs):
"""List all role permissions matching criteria"""
cmd = listRolePermissions.listRolePermissionsCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
return (apiclient.listRolePermissions(cmd))
@@ -249,8 +249,8 @@ def list(cls, apiclient, **kwargs):
listed accounts"""
cmd = listAccounts.listAccountsCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
- if 'account' in kwargs.keys() and 'domainid' in kwargs.keys():
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
+ if 'account' in list(kwargs.keys()) and 'domainid' in list(kwargs.keys()):
cmd.listall = True
return (apiclient.listAccounts(cmd))
@@ -322,8 +322,8 @@ def list(cls, apiclient, **kwargs):
listed users"""
cmd = listUsers.listUsersCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
- if 'account' in kwargs.keys() and 'domainid' in kwargs.keys():
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
+ if 'account' in list(kwargs.keys()) and 'domainid' in list(kwargs.keys()):
cmd.listall = True
return (apiclient.listUsers(cmd))
@@ -338,7 +338,7 @@ def update(self, apiclient, **kwargs):
cmd = updateUser.updateUserCmd()
cmd.id = self.id
- [setattr(cmd, k, v) for k, v in kwargs.items()]
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
return (apiclient.updateUser(cmd))
@classmethod
@@ -347,7 +347,7 @@ def update(cls, apiclient, id, **kwargs):
cmd = updateUser.updateUserCmd()
cmd.id = id
- [setattr(cmd, k, v) for k, v in kwargs.items()]
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
return (apiclient.updateUser(cmd))
@classmethod
@@ -505,7 +505,7 @@ def access_ssh_over_nat(
protocol='All',
cidrlist='0.0.0.0/0'
)
- except CloudstackAPIException, e:
+ except CloudstackAPIException as e:
# This could fail because we've already set up the same rule
if not "There is already a firewall rule specified".lower() in e.errorMsg.lower():
raise
@@ -636,7 +636,7 @@ def create(cls, apiclient, services, templateid=None, accountid=None,
cmd.group = group
cmd.datadisktemplatetodiskofferinglist = []
- for datadisktemplate, diskoffering in datadisktemplate_diskoffering_list.items():
+ for datadisktemplate, diskoffering in list(datadisktemplate_diskoffering_list.items()):
cmd.datadisktemplatetodiskofferinglist.append({
'datadisktemplateid': datadisktemplate,
'diskofferingid': diskoffering
@@ -659,7 +659,7 @@ def create(cls, apiclient, services, templateid=None, accountid=None,
virtual_machine = apiclient.deployVirtualMachine(cmd, method=method)
- if 'password' in virtual_machine.__dict__.keys():
+ if 'password' in list(virtual_machine.__dict__.keys()):
if virtual_machine.password:
services['password'] = virtual_machine.password
@@ -821,7 +821,7 @@ def resetSshKey(self, apiclient, **kwargs):
cmd = resetSSHKeyForVirtualMachine.resetSSHKeyForVirtualMachineCmd()
cmd.id = self.id
- [setattr(cmd, k, v) for k, v in kwargs.items()]
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
return (apiclient.resetSSHKeyForVirtualMachine(cmd))
def update(self, apiclient, **kwargs):
@@ -829,7 +829,7 @@ def update(self, apiclient, **kwargs):
cmd = updateVirtualMachine.updateVirtualMachineCmd()
cmd.id = self.id
- [setattr(cmd, k, v) for k, v in kwargs.items()]
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
return (apiclient.updateVirtualMachine(cmd))
def delete(self, apiclient, expunge=True, **kwargs):
@@ -837,7 +837,7 @@ def delete(self, apiclient, expunge=True, **kwargs):
cmd = destroyVirtualMachine.destroyVirtualMachineCmd()
cmd.id = self.id
cmd.expunge = expunge
- [setattr(cmd, k, v) for k, v in kwargs.items()]
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
apiclient.destroyVirtualMachine(cmd)
def expunge(self, apiclient):
@@ -862,7 +862,7 @@ def migrate_vm_with_volume(self, apiclient, hostid=None, migrateto=None):
cmd.hostid = hostid
if migrateto:
migrateto = []
- for volume, pool in migrateto.items():
+ for volume, pool in list(migrateto.items()):
cmd.migrateto.append({
'volume': volume,
'pool': pool
@@ -950,8 +950,8 @@ def list(cls, apiclient, **kwargs):
"""List all VMs matching criteria"""
cmd = listVirtualMachines.listVirtualMachinesCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
- if 'account' in kwargs.keys() and 'domainid' in kwargs.keys():
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
+ if 'account' in list(kwargs.keys()) and 'domainid' in list(kwargs.keys()):
cmd.listall = True
return (apiclient.listVirtualMachines(cmd))
@@ -1163,8 +1163,8 @@ def list(cls, apiclient, **kwargs):
"""List all volumes matching criteria"""
cmd = listVolumes.listVolumesCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
- if 'account' in kwargs.keys() and 'domainid' in kwargs.keys():
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
+ if 'account' in list(kwargs.keys()) and 'domainid' in list(kwargs.keys()):
cmd.listall = True
return (apiclient.listVolumes(cmd))
@@ -1172,7 +1172,7 @@ def resize(self, apiclient, **kwargs):
"""Resize a volume"""
cmd = resizeVolume.resizeVolumeCmd()
cmd.id = self.id
- [setattr(cmd, k, v) for k, v in kwargs.items()]
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
return (apiclient.resizeVolume(cmd))
@classmethod
@@ -1193,7 +1193,7 @@ def upload(cls, apiclient, services, zoneid=None,
cmd.url = url
else:
cmd.url = services["url"]
- [setattr(cmd, k, v) for k, v in kwargs.items()]
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
return Volume(apiclient.uploadVolume(cmd).__dict__)
def wait_for_upload(self, apiclient, timeout=10, interval=60):
@@ -1244,7 +1244,7 @@ def extract(cls, apiclient, volume_id, zoneid, mode):
def migrate(cls, apiclient, **kwargs):
"""Migrate a volume"""
cmd = migrateVolume.migrateVolumeCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
return (apiclient.migrateVolume(cmd))
@@ -1290,8 +1290,8 @@ def list(cls, apiclient, **kwargs):
"""List all snapshots matching criteria"""
cmd = listSnapshots.listSnapshotsCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
- if 'account' in kwargs.keys() and 'domainid' in kwargs.keys():
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
+ if 'account' in list(kwargs.keys()) and 'domainid' in list(kwargs.keys()):
cmd.listall = True
return (apiclient.listSnapshots(cmd))
@@ -1586,7 +1586,7 @@ def updatePermissions(self, apiclient, **kwargs):
cmd = updateTemplatePermissions.updateTemplatePermissionsCmd()
cmd.id = self.id
- [setattr(cmd, k, v) for k, v in kwargs.items()]
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
return (apiclient.updateTemplatePermissions(cmd))
def update(self, apiclient, **kwargs):
@@ -1594,7 +1594,7 @@ def update(self, apiclient, **kwargs):
cmd = updateTemplate.updateTemplateCmd()
cmd.id = self.id
- [setattr(cmd, k, v) for k, v in kwargs.items()]
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
return (apiclient.updateTemplate(cmd))
def copy(self, apiclient, sourcezoneid, destzoneid):
@@ -1612,8 +1612,8 @@ def list(cls, apiclient, **kwargs):
"""List all templates matching criteria"""
cmd = listTemplates.listTemplatesCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
- if 'account' in kwargs.keys() and 'domainid' in kwargs.keys():
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
+ if 'account' in list(kwargs.keys()) and 'domainid' in list(kwargs.keys()):
cmd.listall = True
return (apiclient.listTemplates(cmd))
@@ -1730,7 +1730,7 @@ def update(self, apiclient, **kwargs):
cmd = updateIso.updateIsoCmd()
cmd.id = self.id
- [setattr(cmd, k, v) for k, v in kwargs.items()]
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
return (apiclient.updateIso(cmd))
@classmethod
@@ -1749,8 +1749,8 @@ def list(cls, apiclient, **kwargs):
"""Lists all available ISO files."""
cmd = listIsos.listIsosCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
- if 'account' in kwargs.keys() and 'domainid' in kwargs.keys():
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
+ if 'account' in list(kwargs.keys()) and 'domainid' in list(kwargs.keys()):
cmd.listall = True
return (apiclient.listIsos(cmd))
@@ -1811,8 +1811,8 @@ def list(cls, apiclient, **kwargs):
"""List all Public IPs matching criteria"""
cmd = listPublicIpAddresses.listPublicIpAddressesCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
- if 'account' in kwargs.keys() and 'domainid' in kwargs.keys():
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
+ if 'account' in list(kwargs.keys()) and 'domainid' in list(kwargs.keys()):
cmd.listall = True
return (apiclient.listPublicIpAddresses(cmd))
@@ -1897,8 +1897,8 @@ def list(cls, apiclient, **kwargs):
"""List all NAT rules matching criteria"""
cmd = listPortForwardingRules.listPortForwardingRulesCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
- if 'account' in kwargs.keys() and 'domainid' in kwargs.keys():
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
+ if 'account' in list(kwargs.keys()) and 'domainid' in list(kwargs.keys()):
cmd.listall = True
return (apiclient.listPortForwardingRules(cmd))
@@ -1960,8 +1960,8 @@ def list(cls, apiclient, **kwargs):
"""List all IP forwarding rules matching criteria"""
cmd = listIpForwardingRules.listIpForwardingRulesCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
- if 'account' in kwargs.keys() and 'domainid' in kwargs.keys():
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
+ if 'account' in list(kwargs.keys()) and 'domainid' in list(kwargs.keys()):
cmd.listall = True
return (apiclient.listIpForwardingRules(cmd))
@@ -2030,8 +2030,8 @@ def list(cls, apiclient, **kwargs):
"""List all Egress Firewall Rules matching criteria"""
cmd = listEgressFirewallRules.listEgressFirewallRulesCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
- if 'account' in kwargs.keys() and 'domainid' in kwargs.keys():
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
+ if 'account' in list(kwargs.keys()) and 'domainid' in list(kwargs.keys()):
cmd.listall = True
return (apiclient.listEgressFirewallRules(cmd))
@@ -2076,8 +2076,8 @@ def list(cls, apiclient, **kwargs):
"""List all Firewall Rules matching criteria"""
cmd = listFirewallRules.listFirewallRulesCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
- if 'account' in kwargs.keys() and 'domainid' in kwargs.keys():
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
+ if 'account' in list(kwargs.keys()) and 'domainid' in list(kwargs.keys()):
cmd.listall = True
return (apiclient.listFirewallRules(cmd))
@@ -2093,7 +2093,7 @@ def listCounters(cls, apiclient, **kwargs):
"""Lists all available Counters."""
cmd = listCounters.listCountersCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
return (apiclient.listCounters(cmd))
@classmethod
@@ -2111,7 +2111,7 @@ def listConditions(cls, apiclient, **kwargs):
"""Lists all available Conditions."""
cmd = listConditions.listConditionsCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
return (apiclient.listConditions(cmd))
@classmethod
@@ -2119,7 +2119,7 @@ def listAutoscalePolicies(cls, apiclient, **kwargs):
"""Lists all available Autoscale Policies."""
cmd = listAutoScalePolicies.listAutoScalePoliciesCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
return (apiclient.listAutoScalePolicies(cmd))
@classmethod
@@ -2141,7 +2141,7 @@ def updateAutoscalePolicy(cls, apiclient, id, **kwargs):
cmd = updateAutoScalePolicy.updateAutoScalePolicyCmd()
cmd.id = id
- [setattr(cmd, k, v) for k, v in kwargs.items()]
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
return (apiclient.updateAutoScalePolicy(cmd))
@classmethod
@@ -2149,7 +2149,7 @@ def listAutoscaleVmPofiles(cls, apiclient, **kwargs):
"""Lists all available AutoscaleVM Profiles."""
cmd = listAutoScaleVmProfiles.listAutoScaleVmProfilesCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
return (apiclient.listAutoScaleVmProfiles(cmd))
@classmethod
@@ -2168,7 +2168,7 @@ def createAutoscaleVmProfile(cls, apiclient, serviceofferingid, zoneid, template
cmd.destroyvmgraceperiod = destroyvmgraceperiod
if counterparam:
- for name, value in counterparam.items():
+ for name, value in list(counterparam.items()):
cmd.counterparam.append({
'name': name,
'value': value
@@ -2182,7 +2182,7 @@ def updateAutoscaleVMProfile(cls, apiclient, id, **kwargs):
cmd = updateAutoScaleVmProfile.updateAutoScaleVmProfileCmd()
cmd.id = id
- [setattr(cmd, k, v) for k, v in kwargs.items()]
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
return (apiclient.updateAutoScaleVmProfile(cmd))
@classmethod
@@ -2207,7 +2207,7 @@ def listAutoscaleVmGroup(cls, apiclient, **kwargs):
"""Lists all available AutoscaleVM Group."""
cmd = listAutoScaleVmGroups.listAutoScaleVmGroupsCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
return (apiclient.listAutoScaleVmGroups(cmd))
@classmethod
@@ -2216,7 +2216,7 @@ def enableAutoscaleVmGroup(cls, apiclient, id, **kwargs):
cmd = enableAutoScaleVmGroup.enableAutoScaleVmGroupCmd()
cmd.id = id
- [setattr(cmd, k, v) for k, v in kwargs.items()]
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
return (apiclient.enableAutoScaleVmGroup(cmd))
@classmethod
@@ -2225,7 +2225,7 @@ def disableAutoscaleVmGroup(cls, apiclient, id, **kwargs):
cmd = disableAutoScaleVmGroup.disableAutoScaleVmGroupCmd()
cmd.id = id
- [setattr(cmd, k, v) for k, v in kwargs.items()]
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
return (apiclient.disableAutoScaleVmGroup(cmd))
@classmethod
@@ -2234,7 +2234,7 @@ def updateAutoscaleVMGroup(cls, apiclient, id, **kwargs):
cmd = updateAutoScaleVmGroup.updateAutoScaleVmGroupCmd()
cmd.id = id
- [setattr(cmd, k, v) for k, v in kwargs.items()]
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
return (apiclient.updateAutoScaleVmGroup(cmd))
@@ -2271,7 +2271,7 @@ def create(cls, apiclient, services, tags=None, domainid=None, cacheMode=None, *
if "serviceofferingdetails" in services:
count = 1
for i in services["serviceofferingdetails"]:
- for key, value in i.items():
+ for key, value in list(i.items()):
setattr(cmd, "serviceofferingdetails[%d].key" % count, key)
setattr(cmd, "serviceofferingdetails[%d].value" % count, value)
count = count + 1
@@ -2306,7 +2306,7 @@ def create(cls, apiclient, services, tags=None, domainid=None, cacheMode=None, *
elif "tags" in services:
cmd.tags = services["tags"]
- [setattr(cmd, k, v) for k, v in kwargs.items()]
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
return ServiceOffering(apiclient.createServiceOffering(cmd).__dict__)
def delete(self, apiclient):
@@ -2321,8 +2321,8 @@ def list(cls, apiclient, **kwargs):
"""Lists all available service offerings."""
cmd = listServiceOfferings.listServiceOfferingsCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
- if 'account' in kwargs.keys() and 'domainid' in kwargs.keys():
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
+ if 'account' in list(kwargs.keys()) and 'domainid' in list(kwargs.keys()):
cmd.listall = True
return (apiclient.listServiceOfferings(cmd))
@@ -2376,7 +2376,7 @@ def create(cls, apiclient, services, tags=None, custom=False, domainid=None, cac
if "provisioningtype" in services:
cmd.provisioningtype = services["provisioningtype"]
- [setattr(cmd, k, v) for k, v in kwargs.items()]
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
return DiskOffering(apiclient.createDiskOffering(cmd).__dict__)
def delete(self, apiclient):
@@ -2391,8 +2391,8 @@ def list(cls, apiclient, **kwargs):
"""Lists all available disk offerings."""
cmd = listDiskOfferings.listDiskOfferingsCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
- if 'account' in kwargs.keys() and 'domainid' in kwargs.keys():
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
+ if 'account' in list(kwargs.keys()) and 'domainid' in list(kwargs.keys()):
cmd.listall = True
return (apiclient.listDiskOfferings(cmd))
@@ -2420,16 +2420,16 @@ def create(cls, apiclient, services, **kwargs):
cmd.forvpc = (services["useVpc"] == "on")
cmd.serviceproviderlist = []
if "serviceProviderList" in services:
- for service, provider in services["serviceProviderList"].items():
+ for service, provider in list(services["serviceProviderList"].items()):
cmd.serviceproviderlist.append({
'service': service,
'provider': provider
})
if "serviceCapabilityList" in services:
cmd.servicecapabilitylist = []
- for service, capability in services["serviceCapabilityList"]. \
- items():
- for ctype, value in capability.items():
+ for service, capability in list(services["serviceCapabilityList"]. \
+ items()):
+ for ctype, value in list(capability.items()):
cmd.servicecapabilitylist.append({
'service': service,
'capabilitytype': ctype,
@@ -2453,7 +2453,7 @@ def create(cls, apiclient, services, **kwargs):
cmd.availability = 'Optional'
- [setattr(cmd, k, v) for k, v in kwargs.items()]
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
return NetworkOffering(apiclient.createNetworkOffering(cmd).__dict__)
@@ -2469,7 +2469,7 @@ def update(self, apiclient, **kwargs):
cmd = updateNetworkOffering.updateNetworkOfferingCmd()
cmd.id = self.id
- [setattr(cmd, k, v) for k, v in kwargs.items()]
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
return (apiclient.updateNetworkOffering(cmd))
@classmethod
@@ -2477,8 +2477,8 @@ def list(cls, apiclient, **kwargs):
"""Lists all available network offerings."""
cmd = listNetworkOfferings.listNetworkOfferingsCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
- if 'account' in kwargs.keys() and 'domainid' in kwargs.keys():
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
+ if 'account' in list(kwargs.keys()) and 'domainid' in list(kwargs.keys()):
cmd.listall = True
return (apiclient.listNetworkOfferings(cmd))
@@ -2512,8 +2512,8 @@ def list(cls, apiclient, **kwargs):
"""Lists snapshot policies."""
cmd = listSnapshotPolicies.listSnapshotPoliciesCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
- if 'account' in kwargs.keys() and 'domainid' in kwargs.keys():
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
+ if 'account' in list(kwargs.keys()) and 'domainid' in list(kwargs.keys()):
cmd.listall = True
return (apiclient.listSnapshotPolicies(cmd))
@@ -2528,14 +2528,14 @@ def __init(self, items):
def listMapping(cls, apiclient, **kwargs):
"""List all Guest Os Mappings matching criteria"""
cmd = listGuestOsMapping.listGuestOsMappingCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
return (apiclient.listGuestOsMapping(cmd))
@classmethod
def listCategories(cls, apiclient, **kwargs):
"""List all Os Categories"""
- [setattr(cmd, k, v) for k, v in kwargs.items()]
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
return (apiclient.listOsCategories(cmd))
@@ -2544,7 +2544,7 @@ def list(cls, apiclient, **kwargs):
"""List all Os Types matching criteria"""
cmd = listOsTypes.listOsTypesCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
return (apiclient.listOsTypes(cmd))
@@ -2559,8 +2559,8 @@ def list(cls, apiclient, **kwargs):
"""Lists hypervisors"""
cmd = listHypervisors.listHypervisorsCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
- if 'account' in kwargs.keys() and 'domainid' in kwargs.keys():
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
+ if 'account' in list(kwargs.keys()) and 'domainid' in list(kwargs.keys()):
cmd.listall = True
return (apiclient.listHypervisors(cmd))
@@ -2649,7 +2649,7 @@ def update(self, apiclient, algorithm=None,
if name:
cmd.name = name
- [setattr(cmd, k, v) for k, v in kwargs.items()]
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
return apiclient.updateLoadBalancerRule(cmd)
def createSticky(
@@ -2664,7 +2664,7 @@ def createSticky(
cmd.description = description
if param:
cmd.param = []
- for name, value in param.items():
+ for name, value in list(param.items()):
cmd.param.append({'name': name, 'value': value})
return apiclient.createLBStickinessPolicy(cmd)
@@ -2681,8 +2681,8 @@ def listStickyPolicies(cls, apiclient, lbruleid, **kwargs):
cmd = listLBStickinessPolicies.listLBStickinessPoliciesCmd()
cmd.lbruleid = lbruleid
- [setattr(cmd, k, v) for k, v in kwargs.items()]
- if 'account' in kwargs.keys() and 'domainid' in kwargs.keys():
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
+ if 'account' in list(kwargs.keys()) and 'domainid' in list(kwargs.keys()):
cmd.listall = True
return apiclient.listLBStickinessPolicies(cmd)
@@ -2691,8 +2691,8 @@ def list(cls, apiclient, **kwargs):
"""List all Load balancing rules matching criteria"""
cmd = listLoadBalancerRules.listLoadBalancerRulesCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
- if 'account' in kwargs.keys() and 'domainid' in kwargs.keys():
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
+ if 'account' in list(kwargs.keys()) and 'domainid' in list(kwargs.keys()):
cmd.listall = True
return (apiclient.listLoadBalancerRules(cmd))
@@ -2706,7 +2706,7 @@ def listLoadBalancerRuleInstances(cls, apiclient, id, lbvmips=False, applied=Non
cmd.applied = applied
cmd.lbvmips = lbvmips
- [setattr(cmd, k, v) for k, v in kwargs.items()]
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
return apiclient.listLoadBalancerRuleInstances(cmd)
@@ -2756,8 +2756,8 @@ def list(cls, apiclient, **kwargs):
"""List all Clusters matching criteria"""
cmd = listClusters.listClustersCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
- if 'account' in kwargs.keys() and 'domainid' in kwargs.keys():
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
+ if 'account' in list(kwargs.keys()) and 'domainid' in list(kwargs.keys()):
cmd.listall = True
return (apiclient.listClusters(cmd))
@@ -2766,7 +2766,7 @@ def update(cls, apiclient, **kwargs):
"""Update cluster information"""
cmd = updateCluster.updateClusterCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
return (apiclient.updateCluster(cmd))
@@ -2829,8 +2829,8 @@ def create(cls, apiclient, cluster, services, zoneid=None, podid=None, hyperviso
retries += -1
return FAILED
except Exception as e:
- print "Exception Occurred Under Host.create : %s" % \
- GetDetailExceptionInfo(e)
+ print("Exception Occurred Under Host.create : %s" % \
+ GetDetailExceptionInfo(e))
return FAILED
@staticmethod
@@ -2895,8 +2895,8 @@ def list(cls, apiclient, **kwargs):
"""List all Hosts matching criteria"""
cmd = listHosts.listHostsCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
- if 'account' in kwargs.keys() and 'domainid' in kwargs.keys():
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
+ if 'account' in list(kwargs.keys()) and 'domainid' in list(kwargs.keys()):
cmd.listall = True
return (apiclient.listHosts(cmd))
@@ -2905,8 +2905,8 @@ def listForMigration(cls, apiclient, **kwargs):
"""List all Hosts for migration matching criteria"""
cmd = findHostsForMigration.findHostsForMigrationCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
- if 'account' in kwargs.keys() and 'domainid' in kwargs.keys():
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
+ if 'account' in list(kwargs.keys()) and 'domainid' in list(kwargs.keys()):
cmd.listall = True
return (apiclient.findHostsForMigration(cmd))
@@ -2915,7 +2915,7 @@ def update(cls, apiclient, **kwargs):
"""Update host information"""
cmd = updateHost.updateHostCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
return (apiclient.updateHost(cmd))
@classmethod
@@ -2923,7 +2923,7 @@ def reconnect(cls, apiclient, **kwargs):
"""Reconnect the Host"""
cmd = reconnectHost.reconnectHostCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
return (apiclient.reconnectHost(cmd))
@classmethod
@@ -3054,8 +3054,8 @@ def list(cls, apiclient, **kwargs):
"""List all storage pools matching criteria"""
cmd = listStoragePools.listStoragePoolsCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
- if 'account' in kwargs.keys() and 'domainid' in kwargs.keys():
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
+ if 'account' in list(kwargs.keys()) and 'domainid' in list(kwargs.keys()):
cmd.listall = True
return (apiclient.listStoragePools(cmd))
@@ -3064,8 +3064,8 @@ def listForMigration(cls, apiclient, **kwargs):
"""List all storage pools for migration matching criteria"""
cmd = findStoragePoolsForMigration.findStoragePoolsForMigrationCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
- if 'account' in kwargs.keys() and 'domainid' in kwargs.keys():
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
+ if 'account' in list(kwargs.keys()) and 'domainid' in list(kwargs.keys()):
cmd.listall = True
return (apiclient.findStoragePoolsForMigration(cmd))
@@ -3073,7 +3073,7 @@ def listForMigration(cls, apiclient, **kwargs):
def update(cls, apiclient, **kwargs):
"""Update storage pool"""
cmd = updateStoragePool.updateStoragePoolCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
return apiclient.updateStoragePool(cmd)
@classmethod
@@ -3187,7 +3187,7 @@ def update(self, apiclient, **kwargs):
cmd = updateNetwork.updateNetworkCmd()
cmd.id = self.id
- [setattr(cmd, k, v) for k, v in kwargs.items()]
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
return (apiclient.updateNetwork(cmd))
def restart(self, apiclient, cleanup=None, makeredundant=None):
@@ -3213,8 +3213,8 @@ def list(cls, apiclient, **kwargs):
"""List all Networks matching criteria"""
cmd = listNetworks.listNetworksCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
- if 'account' in kwargs.keys() and 'domainid' in kwargs.keys():
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
+ if 'account' in list(kwargs.keys()) and 'domainid' in list(kwargs.keys()):
cmd.listall = True
return (apiclient.listNetworks(cmd))
@@ -3290,8 +3290,8 @@ def list(cls, apiclient, **kwargs):
"""List Network ACLs"""
cmd = listNetworkACLs.listNetworkACLsCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
- if 'account' in kwargs.keys() and 'domainid' in kwargs.keys():
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
+ if 'account' in list(kwargs.keys()) and 'domainid' in list(kwargs.keys()):
cmd.listall = True
return (apiclient.listNetworkACLs(cmd))
@@ -3337,8 +3337,8 @@ def list(cls, apiclient, **kwargs):
"""List Network ACL lists"""
cmd = listNetworkACLLists.listNetworkACLListsCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
- if 'account' in kwargs.keys() and 'domainid' in kwargs.keys():
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
+ if 'account' in list(kwargs.keys()) and 'domainid' in list(kwargs.keys()):
cmd.listall = True
return (apiclient.listNetworkACLLists(cmd))
@@ -3408,14 +3408,14 @@ def deleteVpnConnection(cls, apiclient, id):
def listVpnGateway(cls, apiclient, **kwargs):
"""List all VPN Gateways matching criteria"""
cmd = listVpnGateways.listVpnGatewaysCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
return (apiclient.listVpnGateways(cmd))
@classmethod
def listVpnConnection(cls, apiclient, **kwargs):
"""List all VPN Connections matching criteria"""
cmd = listVpnConnections.listVpnConnectionsCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
return (apiclient.listVpnConnections(cmd))
def delete(self, apiclient):
@@ -3430,8 +3430,8 @@ def list(cls, apiclient, **kwargs):
"""List all VPN matching criteria"""
cmd = listRemoteAccessVpns.listRemoteAccessVpnsCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
- if 'account' in kwargs.keys() and 'domainid' in kwargs.keys():
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
+ if 'account' in list(kwargs.keys()) and 'domainid' in list(kwargs.keys()):
cmd.listall = True
return (apiclient.listRemoteAccessVpns(cmd))
@@ -3476,8 +3476,8 @@ def list(cls, apiclient, **kwargs):
"""List all VPN Users matching criteria"""
cmd = listVpnUsers.listVpnUsersCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
- if 'account' in kwargs.keys() and 'domainid' in kwargs.keys():
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
+ if 'account' in list(kwargs.keys()) and 'domainid' in list(kwargs.keys()):
cmd.listall = True
return (apiclient.listVpnUsers(cmd))
@@ -3520,7 +3520,7 @@ def update(self, apiclient, **kwargs):
cmd = updateZone.updateZoneCmd()
cmd.id = self.id
- [setattr(cmd, k, v) for k, v in kwargs.items()]
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
return apiclient.updateZone(cmd)
@classmethod
@@ -3528,8 +3528,8 @@ def list(cls, apiclient, **kwargs):
"""List all Zones matching criteria"""
cmd = listZones.listZonesCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
- if 'account' in kwargs.keys() and 'domainid' in kwargs.keys():
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
+ if 'account' in list(kwargs.keys()) and 'domainid' in list(kwargs.keys()):
cmd.listall = True
return (apiclient.listZones(cmd))
@@ -3565,8 +3565,8 @@ def list(cls, apiclient, **kwargs):
"Returns a default pod for specified zone"
cmd = listPods.listPodsCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
- if 'account' in kwargs.keys() and 'domainid' in kwargs.keys():
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
+ if 'account' in list(kwargs.keys()) and 'domainid' in list(kwargs.keys()):
cmd.listall = True
return apiclient.listPods(cmd)
@@ -3575,7 +3575,7 @@ def update(self, apiclient, **kwargs):
"""Update the pod"""
cmd = updatePod.updatePodCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
return apiclient.updatePod(cmd)
@@ -3621,8 +3621,8 @@ def list(cls, apiclient, **kwargs):
"""Lists all VLAN IP ranges."""
cmd = listVlanIpRanges.listVlanIpRangesCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
- if 'account' in kwargs.keys() and 'domainid' in kwargs.keys():
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
+ if 'account' in list(kwargs.keys()) and 'domainid' in list(kwargs.keys()):
cmd.listall = True
return (apiclient.listVlanIpRanges(cmd))
@@ -3681,8 +3681,8 @@ def list(cls, apiclient, **kwargs):
"""Lists all portable public IP ranges."""
cmd = listPortableIpRanges.listPortableIpRangesCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
- if 'account' in kwargs.keys() and 'domainid' in kwargs.keys():
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
+ if 'account' in list(kwargs.keys()) and 'domainid' in list(kwargs.keys()):
cmd.listall = True
return (apiclient.listPortableIpRanges(cmd))
@@ -3718,8 +3718,8 @@ def delete(self, apiclient):
@classmethod
def list(cls, apiclient, **kwargs):
cmd = listSecondaryStagingStores.listSecondaryStagingStoresCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
- if 'account' in kwargs.keys() and 'domainid' in kwargs.keys():
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
+ if 'account' in list(kwargs.keys()) and 'domainid' in list(kwargs.keys()):
cmd.listall = True
return (apiclient.listSecondaryStagingStores(cmd))
@@ -3755,8 +3755,8 @@ def delete(self, apiclient):
@classmethod
def list(cls, apiclient, **kwargs):
cmd = listImageStores.listImageStoresCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
- if 'account' in kwargs.keys() and 'domainid' in kwargs.keys():
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
+ if 'account' in list(kwargs.keys()) and 'domainid' in list(kwargs.keys()):
cmd.listall = True
return (apiclient.listImageStores(cmd))
@@ -3790,7 +3790,7 @@ def update(self, apiclient, **kwargs):
cmd = updatePhysicalNetwork.updatePhysicalNetworkCmd()
cmd.id = self.id
- [setattr(cmd, k, v) for k, v in kwargs.items()]
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
return apiclient.updatePhysicalNetwork(cmd)
def addTrafficType(self, apiclient, type):
@@ -3827,8 +3827,8 @@ def listDedicated(cls, apiclient, **kwargs):
"""Lists all dedicated guest vlan ranges"""
cmd = listDedicatedGuestVlanRanges.listDedicatedGuestVlanRangesCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
- if 'account' in kwargs.keys() and 'domainid' in kwargs.keys():
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
+ if 'account' in list(kwargs.keys()) and 'domainid' in list(kwargs.keys()):
cmd.listall = True
return apiclient.listDedicatedGuestVlanRanges(cmd)
@@ -3837,11 +3837,11 @@ def list(cls, apiclient, **kwargs):
"""Lists all physical networks"""
cmd = listPhysicalNetworks.listPhysicalNetworksCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
- if 'account' in kwargs.keys() and 'domainid' in kwargs.keys():
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
+ if 'account' in list(kwargs.keys()) and 'domainid' in list(kwargs.keys()):
cmd.listall = True
- return map(lambda pn: PhysicalNetwork(
- pn.__dict__), apiclient.listPhysicalNetworks(cmd))
+ return [PhysicalNetwork(
+ pn.__dict__) for pn in apiclient.listPhysicalNetworks(cmd)]
class SecurityGroup:
@@ -3934,7 +3934,7 @@ def authorizeEgress(self, apiclient, services, account=None, domainid=None,
cmd.cidrlist = services["cidrlist"]
cmd.usersecuritygrouplist = []
- for account, group in user_secgrp_list.items():
+ for account, group in list(user_secgrp_list.items()):
cmd.usersecuritygrouplist.append({
'account': account,
'group': group
@@ -3954,8 +3954,8 @@ def list(cls, apiclient, **kwargs):
"""Lists all security groups."""
cmd = listSecurityGroups.listSecurityGroupsCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
- if 'account' in kwargs.keys() and 'domainid' in kwargs.keys():
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
+ if 'account' in list(kwargs.keys()) and 'domainid' in list(kwargs.keys()):
cmd.listall = True
return (apiclient.listSecurityGroups(cmd))
@@ -4034,8 +4034,8 @@ def list(cls, apiclient, **kwargs):
"""List all VPN customer Gateway"""
cmd = listVpnCustomerGateways.listVpnCustomerGatewaysCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
- if 'account' in kwargs.keys() and 'domainid' in kwargs.keys():
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
+ if 'account' in list(kwargs.keys()) and 'domainid' in list(kwargs.keys()):
cmd.listall = True
return (apiclient.listVpnCustomerGateways(cmd))
@@ -4075,7 +4075,7 @@ def update(self, apiclient, **kwargs):
cmd = updateProject.updateProjectCmd()
cmd.id = self.id
- [setattr(cmd, k, v) for k, v in kwargs.items()]
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
return apiclient.updateProject(cmd)
def activate(self, apiclient):
@@ -4143,8 +4143,8 @@ def listAccounts(cls, apiclient, **kwargs):
"""Lists all accounts associated with projects."""
cmd = listProjectAccounts.listProjectAccountsCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
- if 'account' in kwargs.keys() and 'domainid' in kwargs.keys():
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
+ if 'account' in list(kwargs.keys()) and 'domainid' in list(kwargs.keys()):
cmd.listall = True
return (apiclient.listProjectAccounts(cmd))
@@ -4153,8 +4153,8 @@ def list(cls, apiclient, **kwargs):
"""Lists all projects."""
cmd = listProjects.listProjectsCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
- if 'account' in kwargs.keys() and 'domainid' in kwargs.keys():
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
+ if 'account' in list(kwargs.keys()) and 'domainid' in list(kwargs.keys()):
cmd.listall = True
return (apiclient.listProjects(cmd))
@@ -4193,8 +4193,8 @@ def list(cls, apiclient, **kwargs):
"""Lists project invitations"""
cmd = listProjectInvitations.listProjectInvitationsCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
- if 'account' in kwargs.keys() and 'domainid' in kwargs.keys():
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
+ if 'account' in list(kwargs.keys()) and 'domainid' in list(kwargs.keys()):
cmd.listall = True
return (apiclient.listProjectInvitations(cmd))
@@ -4227,8 +4227,8 @@ def list(cls, apiclient, **kwargs):
"""Lists configurations"""
cmd = listConfigurations.listConfigurationsCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
- if 'account' in kwargs.keys() and 'domainid' in kwargs.keys():
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
+ if 'account' in list(kwargs.keys()) and 'domainid' in list(kwargs.keys()):
cmd.listall = True
return (apiclient.listConfigurations(cmd))
@@ -4236,7 +4236,7 @@ def list(cls, apiclient, **kwargs):
def listCapabilities(cls, apiclient, **kwargs):
"""Lists capabilities"""
cmd = listCapabilities.listCapabilitiesCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
return (apiclient.listCapabilities(cmd))
@@ -4295,7 +4295,7 @@ def configure(self, apiclient, **kwargs):
cmd = configureNetscalerLoadBalancer. \
configureNetscalerLoadBalancerCmd()
cmd.lbdeviceid = self.lbdeviceid
- [setattr(cmd, k, v) for k, v in kwargs.items()]
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
return (apiclient.configureNetscalerLoadBalancer(cmd))
@classmethod
@@ -4303,8 +4303,8 @@ def list(cls, apiclient, **kwargs):
"""List already registered netscaler devices"""
cmd = listNetscalerLoadBalancers.listNetscalerLoadBalancersCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
- if 'account' in kwargs.keys() and 'domainid' in kwargs.keys():
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
+ if 'account' in list(kwargs.keys()) and 'domainid' in list(kwargs.keys()):
cmd.listall = True
return (apiclient.listNetscalerLoadBalancers(cmd))
@@ -4355,8 +4355,8 @@ def delete(self, apiclient):
@classmethod
def list(cls, apiclient, **kwargs):
cmd = listNiciraNvpDevices.listNiciraNvpDevicesCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
- if 'account' in kwargs.keys() and 'domainid' in kwargs.keys():
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
+ if 'account' in list(kwargs.keys()) and 'domainid' in list(kwargs.keys()):
cmd.listall = True
return (apiclient.listNiciraNvpDevices(cmd))
@@ -4390,7 +4390,7 @@ def update(self, apiclient, **kwargs):
cmd = updateNetworkServiceProvider.updateNetworkServiceProviderCmd()
cmd.id = self.id
- [setattr(cmd, k, v) for k, v in kwargs.items()]
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
return apiclient.updateNetworkServiceProvider(cmd)
@classmethod
@@ -4399,7 +4399,7 @@ def update(cls, apiclient, id, **kwargs):
cmd = updateNetworkServiceProvider.updateNetworkServiceProviderCmd()
cmd.id = id
- [setattr(cmd, k, v) for k, v in kwargs.items()]
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
return apiclient.updateNetworkServiceProvider(cmd)
@classmethod
@@ -4407,8 +4407,8 @@ def list(cls, apiclient, **kwargs):
"""List network service providers"""
cmd = listNetworkServiceProviders.listNetworkServiceProvidersCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
- if 'account' in kwargs.keys() and 'domainid' in kwargs.keys():
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
+ if 'account' in list(kwargs.keys()) and 'domainid' in list(kwargs.keys()):
cmd.listall = True
return (apiclient.listNetworkServiceProviders(cmd))
@@ -4462,8 +4462,8 @@ def list(cls, apiclient, **kwargs):
"""List routers"""
cmd = listRouters.listRoutersCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
- if 'account' in kwargs.keys() and 'domainid' in kwargs.keys():
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
+ if 'account' in list(kwargs.keys()) and 'domainid' in list(kwargs.keys()):
cmd.listall = True
return (apiclient.listRouters(cmd))
@@ -4482,7 +4482,7 @@ def create(cls, apiclient, resourceIds, resourceType, tags):
cmd.resourceIds = resourceIds
cmd.resourcetype = resourceType
cmd.tags = []
- for key, value in tags.items():
+ for key, value in list(tags.items()):
cmd.tags.append({
'key': key,
'value': value
@@ -4497,7 +4497,7 @@ def delete(cls, apiclient, resourceIds, resourceType, tags):
cmd.resourceIds = resourceIds
cmd.resourcetype = resourceType
cmd.tags = []
- for key, value in tags.items():
+ for key, value in list(tags.items()):
cmd.tags.append({
'key': key,
'value': value
@@ -4509,8 +4509,8 @@ def list(cls, apiclient, **kwargs):
"""List all tags matching the criteria"""
cmd = listTags.listTagsCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
- if 'account' in kwargs.keys() and 'domainid' in kwargs.keys():
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
+ if 'account' in list(kwargs.keys()) and 'domainid' in list(kwargs.keys()):
cmd.listall = True
return (apiclient.listTags(cmd))
@@ -4532,7 +4532,7 @@ def create(cls, apiclient, services):
cmd.displaytext = services["displaytext"]
cmd.supportedServices = services["supportedservices"]
if "serviceProviderList" in services:
- for service, provider in services["serviceProviderList"].items():
+ for service, provider in list(services["serviceProviderList"].items()):
providers = provider
if isinstance(provider, str):
providers = [provider]
@@ -4546,8 +4546,8 @@ def create(cls, apiclient, services):
if "serviceCapabilityList" in services:
cmd.servicecapabilitylist = []
for service, capability in \
- services["serviceCapabilityList"].items():
- for ctype, value in capability.items():
+ list(services["serviceCapabilityList"].items()):
+ for ctype, value in list(capability.items()):
cmd.servicecapabilitylist.append({
'service': service,
'capabilitytype': ctype,
@@ -4573,8 +4573,8 @@ def list(cls, apiclient, **kwargs):
"""List the VPC offerings based on criteria specified"""
cmd = listVPCOfferings.listVPCOfferingsCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
- if 'account' in kwargs.keys() and 'domainid' in kwargs.keys():
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
+ if 'account' in list(kwargs.keys()) and 'domainid' in list(kwargs.keys()):
cmd.listall = True
return (apiclient.listVPCOfferings(cmd))
@@ -4611,7 +4611,7 @@ def create(cls, apiclient, services, vpcofferingid,
cmd.domainid = domainid
if networkDomain:
cmd.networkDomain = networkDomain
- [setattr(cmd, k, v) for k, v in kwargs.items()]
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
return VPC(apiclient.createVPC(cmd).__dict__)
def update(self, apiclient, name=None, displaytext=None):
@@ -4656,8 +4656,8 @@ def list(cls, apiclient, **kwargs):
"""List VPCs"""
cmd = listVPCs.listVPCsCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
- if 'account' in kwargs.keys() and 'domainid' in kwargs.keys():
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
+ if 'account' in list(kwargs.keys()) and 'domainid' in list(kwargs.keys()):
cmd.listall = True
return (apiclient.listVPCs(cmd))
@@ -4700,8 +4700,8 @@ def list(cls, apiclient, **kwargs):
"""List private gateways"""
cmd = listPrivateGateways.listPrivateGatewaysCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
- if 'account' in kwargs.keys() and 'domainid' in kwargs.keys():
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
+ if 'account' in list(kwargs.keys()) and 'domainid' in list(kwargs.keys()):
cmd.listall = True
return (apiclient.listPrivateGateways(cmd))
@@ -4735,8 +4735,8 @@ def delete(self, apiclient):
@classmethod
def list(cls, apiclient, **kwargs):
cmd = listAffinityGroups.listAffinityGroupsCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
- if 'account' in kwargs.keys() and 'domainid' in kwargs.keys():
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
+ if 'account' in list(kwargs.keys()) and 'domainid' in list(kwargs.keys()):
cmd.listall = True
return apiclient.listAffinityGroups(cmd)
@@ -4768,8 +4768,8 @@ def list(cls, apiclient, **kwargs):
"""List static route"""
cmd = listStaticRoutes.listStaticRoutesCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
- if 'account' in kwargs.keys() and 'domainid' in kwargs.keys():
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
+ if 'account' in list(kwargs.keys()) and 'domainid' in list(kwargs.keys()):
cmd.listall = True
return (apiclient.listStaticRoutes(cmd))
@@ -4803,8 +4803,8 @@ def list(cls, apiclient, **kwargs):
"""List VNMC appliances"""
cmd = listCiscoVnmcResources.listCiscoVnmcResourcesCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
- if 'account' in kwargs.keys() and 'domainid' in kwargs.keys():
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
+ if 'account' in list(kwargs.keys()) and 'domainid' in list(kwargs.keys()):
cmd.listall = True
return (apiclient.listCiscoVnmcResources(cmd))
@@ -4847,8 +4847,8 @@ def delete(self, apiclient):
def list(cls, apiclient, **kwargs):
"""List all SSH key pairs"""
cmd = listSSHKeyPairs.listSSHKeyPairsCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
- if 'account' in kwargs.keys() and 'domainid' in kwargs.keys():
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
+ if 'account' in list(kwargs.keys()) and 'domainid' in list(kwargs.keys()):
cmd.listall = True
return (apiclient.listSSHKeyPairs(cmd))
@@ -4861,8 +4861,8 @@ def list(cls, apiclient, **kwargs):
"""Lists capacities"""
cmd = listCapacity.listCapacityCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
- if 'account' in kwargs.keys() and 'domainid' in kwargs.keys():
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
+ if 'account' in list(kwargs.keys()) and 'domainid' in list(kwargs.keys()):
cmd.listall = True
return (apiclient.listCapacity(cmd))
@@ -4875,8 +4875,8 @@ def list(cls, apiclient, **kwargs):
"""Lists alerts"""
cmd = listAlerts.listAlertsCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
- if 'account' in kwargs.keys() and 'domainid' in kwargs.keys():
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
+ if 'account' in list(kwargs.keys()) and 'domainid' in list(kwargs.keys()):
cmd.listall = True
return (apiclient.listAlerts(cmd))
@@ -4914,15 +4914,15 @@ def update(self, apiclient, **kwargs):
"""Updates the instance groups"""
cmd = updateInstanceGroup.updateInstanceGroupCmd()
cmd.id = self.id
- [setattr(cmd, k, v) for k, v in kwargs.items()]
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
return (apiclient.updateInstanceGroup(cmd))
@classmethod
def list(cls, apiclient, **kwargs):
"""List all instance groups"""
cmd = listInstanceGroups.listInstanceGroupsCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
- if 'account' in kwargs.keys() and 'domainid' in kwargs.keys():
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
+ if 'account' in list(kwargs.keys()) and 'domainid' in list(kwargs.keys()):
cmd.listall = True
return (apiclient.listInstanceGroups(cmd))
@@ -4996,8 +4996,8 @@ def list(cls, apiclient, **kwargs):
"""List ASA 1000v appliances"""
cmd = listCiscoAsa1000vResources.listCiscoAsa1000vResourcesCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
- if 'account' in kwargs.keys() and 'domainid' in kwargs.keys():
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
+ if 'account' in list(kwargs.keys()) and 'domainid' in list(kwargs.keys()):
cmd.listall = True
return (apiclient.listCiscoAsa1000vResources(cmd))
@@ -5025,8 +5025,8 @@ def create(cls, apiclient, vmid, snapshotmemory="false",
@classmethod
def list(cls, apiclient, **kwargs):
cmd = listVMSnapshot.listVMSnapshotCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
- if 'account' in kwargs.keys() and 'domainid' in kwargs.keys():
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
+ if 'account' in list(kwargs.keys()) and 'domainid' in list(kwargs.keys()):
cmd.listall = True
return (apiclient.listVMSnapshot(cmd))
@@ -5065,8 +5065,8 @@ def create(cls, apiclient, services):
@classmethod
def list(cls, apiclient, **kwargs):
cmd = listRegions.listRegionsCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
- if 'account' in kwargs.keys() and 'domainid' in kwargs.keys():
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
+ if 'account' in list(kwargs.keys()) and 'domainid' in list(kwargs.keys()):
cmd.listall = True
region = apiclient.listRegions(cmd)
return region
@@ -5176,8 +5176,8 @@ def remove(self, apiclient, vms=None, vmidipmap=None):
def list(cls, apiclient, **kwargs):
"""List all appln load balancers"""
cmd = listLoadBalancers.listLoadBalancersCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
- if 'account' in kwargs.keys() and 'domainid' in kwargs.keys():
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
+ if 'account' in list(kwargs.keys()) and 'domainid' in list(kwargs.keys()):
cmd.listall = True
return (apiclient.listLoadBalancerRules(cmd))
@@ -5193,8 +5193,8 @@ def list(cls, apiclient, **kwargs):
"""Lists resource limits"""
cmd = listResourceLimits.listResourceLimitsCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
- if 'account' in kwargs.keys() and 'domainid' in kwargs.keys():
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
+ if 'account' in list(kwargs.keys()) and 'domainid' in list(kwargs.keys()):
cmd.listall = True
return (apiclient.listResourceLimits(cmd))
@@ -5203,7 +5203,7 @@ def updateLimit(cls, apiclient, **kwargs):
"""Updates resource limits"""
cmd = updateResourceLimit.updateResourceLimitCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
return (apiclient.updateResourceLimit(cmd))
@classmethod
@@ -5211,7 +5211,7 @@ def updateCount(cls, apiclient, **kwargs):
"""Updates resource count"""
cmd = updateResourceCount.updateResourceCountCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
return (apiclient.updateResourceCount(cmd))
@@ -5242,8 +5242,8 @@ def list(cls, apiclient, **kwargs):
"""List NICs belonging to a virtual machine"""
cmd = listNics.listNicsCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
- if 'account' in kwargs.keys() and 'domainid' in kwargs.keys():
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
+ if 'account' in list(kwargs.keys()) and 'domainid' in list(kwargs.keys()):
cmd.listall = True
return (apiclient.listNics(cmd))
@@ -5303,8 +5303,8 @@ def __init__(self, items):
def listRecords(cls, apiclient, **kwargs):
"""Lists domains"""
cmd = listUsageRecords.listUsageRecordsCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
- if 'account' in kwargs.keys() and 'domainid' in kwargs.keys():
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
+ if 'account' in list(kwargs.keys()) and 'domainid' in list(kwargs.keys()):
cmd.listall = True
return (apiclient.listUsageRecords(cmd))
@@ -5312,8 +5312,8 @@ def listRecords(cls, apiclient, **kwargs):
def listTypes(cls, apiclient, **kwargs):
"""Lists domains"""
cmd = listUsageTypes.listUsageTypesCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
- if 'account' in kwargs.keys() and 'domainid' in kwargs.keys():
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
+ if 'account' in list(kwargs.keys()) and 'domainid' in list(kwargs.keys()):
cmd.listall = True
return (apiclient.listUsageTypes(cmd))
@@ -5321,7 +5321,7 @@ def listTypes(cls, apiclient, **kwargs):
def generateRecords(cls, apiclient, **kwargs):
"""Lists domains"""
cmd = generateUsageRecords.generateUsageRecordsCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
return (apiclient.generateUsageRecords(cmd))
@@ -5336,7 +5336,7 @@ def list(cls, apiclient, **kwargs):
"""Lists traffic types"""
cmd = listTrafficTypes.listTrafficTypesCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
return (apiclient.listTrafficTypes(cmd))
@@ -5351,7 +5351,7 @@ def list(cls, apiclient, **kwargs):
"""Lists Storage Network IP Ranges"""
cmd = listStorageNetworkIpRange.listStorageNetworkIpRangeCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
return (apiclient.listStorageNetworkIpRange(cmd))
@@ -5366,7 +5366,7 @@ def list(cls, apiclient, **kwargs):
"""Lists service packages published by NCC"""
cmd = listRegisteredServicePackages.listRegisteredServicePackagesCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
return (apiclient.listRegisteredServicePackages(cmd))
@@ -5381,7 +5381,7 @@ def create(cls, apiclient, resourceid, resourcetype, details, fordisplay):
cmd.resourcetype = resourcetype
cmd.fordisplay = fordisplay
cmd.details = []
- for key, value in details.items():
+ for key, value in list(details.items()):
cmd.details.append({
'key': key,
'value': value
@@ -5391,7 +5391,7 @@ def create(cls, apiclient, resourceid, resourcetype, details, fordisplay):
@classmethod
def list(self, apiclient, **kwargs):
cmd = listResourceDetails.listResourceDetailsCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
return (apiclient.listResourceDetails(cmd))
@classmethod
@@ -5534,7 +5534,7 @@ def update(self, apiclient, projectid, **kwargs):
cmd = updateProjectRole.updateProjectRoleCmd()
cmd.projectid = projectid
cmd.id = self.id
- [setattr(cmd, k, v) for k, v in kwargs.items()]
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
return apiclient.updateProjectRole(cmd)
@classmethod
@@ -5543,7 +5543,7 @@ def list(cls, apiclient, projectid, **kwargs):
cmd = listProjectRoles.listProjectRolesCmd()
cmd.projectid = projectid
- [setattr(cmd, k, v) for k, v in kwargs.items()]
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
return (apiclient.listProjectRoles(cmd))
class ProjectRolePermission:
@@ -5579,7 +5579,7 @@ def update(self, apiclient, projectid, **kwargs):
cmd = updateProjectRolePermission.updateProjectRolePermissionCmd()
cmd.projectid = projectid
cmd.projectroleid = self.projectroleid
- [setattr(cmd, k, v) for k, v in kwargs.items()]
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
return apiclient.updateProjectRolePermission(cmd)
@classmethod
@@ -5588,5 +5588,5 @@ def list(cls, apiclient, projectid, **kwargs):
cmd = listProjectRolePermissions.listProjectRolePermissionsCmd()
cmd.projectid = projectid
- [setattr(cmd, k, v) for k, v in kwargs.items()]
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
return (apiclient.listProjectRolePermissions(cmd))
diff --git a/tools/marvin/marvin/lib/common.py b/tools/marvin/marvin/lib/common.py
index fc9c72d88d67..c13b26e4d5cc 100644
--- a/tools/marvin/marvin/lib/common.py
+++ b/tools/marvin/marvin/lib/common.py
@@ -368,8 +368,8 @@ def get_test_template(apiclient, zone_id=None, hypervisor=None, test_templates=N
if hypervisor == 'simulator':
return get_template(apiclient, zone_id)
- if hypervisor not in test_templates.keys():
- print "Provided hypervisor has no test template"
+ if hypervisor not in list(test_templates.keys()):
+ print("Provided hypervisor has no test template")
return FAILED
test_template = test_templates[hypervisor]
@@ -726,8 +726,8 @@ def list_os_types(apiclient, **kwargs):
"""List all os types matching criteria"""
cmd = listOsTypes.listOsTypesCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
- if 'account' in kwargs.keys() and 'domainid' in kwargs.keys():
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
+ if 'account' in list(kwargs.keys()) and 'domainid' in list(kwargs.keys()):
cmd.listall=True
return(apiclient.listOsTypes(cmd))
@@ -736,8 +736,8 @@ def list_routers(apiclient, **kwargs):
"""List all Routers matching criteria"""
cmd = listRouters.listRoutersCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
- if 'account' in kwargs.keys() and 'domainid' in kwargs.keys():
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
+ if 'account' in list(kwargs.keys()) and 'domainid' in list(kwargs.keys()):
cmd.listall=True
return(apiclient.listRouters(cmd))
@@ -746,8 +746,8 @@ def list_zones(apiclient, **kwargs):
"""List all Zones matching criteria"""
cmd = listZones.listZonesCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
- if 'account' in kwargs.keys() and 'domainid' in kwargs.keys():
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
+ if 'account' in list(kwargs.keys()) and 'domainid' in list(kwargs.keys()):
cmd.listall=True
return(apiclient.listZones(cmd))
@@ -756,8 +756,8 @@ def list_networks(apiclient, **kwargs):
"""List all Networks matching criteria"""
cmd = listNetworks.listNetworksCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
- if 'account' in kwargs.keys() and 'domainid' in kwargs.keys():
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
+ if 'account' in list(kwargs.keys()) and 'domainid' in list(kwargs.keys()):
cmd.listall=True
return(apiclient.listNetworks(cmd))
@@ -766,8 +766,8 @@ def list_clusters(apiclient, **kwargs):
"""List all Clusters matching criteria"""
cmd = listClusters.listClustersCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
- if 'account' in kwargs.keys() and 'domainid' in kwargs.keys():
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
+ if 'account' in list(kwargs.keys()) and 'domainid' in list(kwargs.keys()):
cmd.listall=True
return(apiclient.listClusters(cmd))
@@ -776,8 +776,8 @@ def list_ssvms(apiclient, **kwargs):
"""List all SSVMs matching criteria"""
cmd = listSystemVms.listSystemVmsCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
- if 'account' in kwargs.keys() and 'domainid' in kwargs.keys():
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
+ if 'account' in list(kwargs.keys()) and 'domainid' in list(kwargs.keys()):
cmd.listall=True
return(apiclient.listSystemVms(cmd))
@@ -786,8 +786,8 @@ def list_storage_pools(apiclient, **kwargs):
"""List all storage pools matching criteria"""
cmd = listStoragePools.listStoragePoolsCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
- if 'account' in kwargs.keys() and 'domainid' in kwargs.keys():
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
+ if 'account' in list(kwargs.keys()) and 'domainid' in list(kwargs.keys()):
cmd.listall=True
return(apiclient.listStoragePools(cmd))
@@ -796,8 +796,8 @@ def list_virtual_machines(apiclient, **kwargs):
"""List all VMs matching criteria"""
cmd = listVirtualMachines.listVirtualMachinesCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
- if 'account' in kwargs.keys() and 'domainid' in kwargs.keys():
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
+ if 'account' in list(kwargs.keys()) and 'domainid' in list(kwargs.keys()):
cmd.listall=True
return(apiclient.listVirtualMachines(cmd))
@@ -806,8 +806,8 @@ def list_hosts(apiclient, **kwargs):
"""List all Hosts matching criteria"""
cmd = listHosts.listHostsCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
- if 'account' in kwargs.keys() and 'domainid' in kwargs.keys():
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
+ if 'account' in list(kwargs.keys()) and 'domainid' in list(kwargs.keys()):
cmd.listall=True
return(apiclient.listHosts(cmd))
@@ -816,8 +816,8 @@ def list_configurations(apiclient, **kwargs):
"""List configuration with specified name"""
cmd = listConfigurations.listConfigurationsCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
- if 'account' in kwargs.keys() and 'domainid' in kwargs.keys():
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
+ if 'account' in list(kwargs.keys()) and 'domainid' in list(kwargs.keys()):
cmd.listall=True
return(apiclient.listConfigurations(cmd))
@@ -826,8 +826,8 @@ def list_publicIP(apiclient, **kwargs):
"""List all Public IPs matching criteria"""
cmd = listPublicIpAddresses.listPublicIpAddressesCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
- if 'account' in kwargs.keys() and 'domainid' in kwargs.keys():
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
+ if 'account' in list(kwargs.keys()) and 'domainid' in list(kwargs.keys()):
cmd.listall=True
return(apiclient.listPublicIpAddresses(cmd))
@@ -836,8 +836,8 @@ def list_nat_rules(apiclient, **kwargs):
"""List all NAT rules matching criteria"""
cmd = listPortForwardingRules.listPortForwardingRulesCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
- if 'account' in kwargs.keys() and 'domainid' in kwargs.keys():
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
+ if 'account' in list(kwargs.keys()) and 'domainid' in list(kwargs.keys()):
cmd.listall=True
return(apiclient.listPortForwardingRules(cmd))
@@ -846,8 +846,8 @@ def list_lb_rules(apiclient, **kwargs):
"""List all Load balancing rules matching criteria"""
cmd = listLoadBalancerRules.listLoadBalancerRulesCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
- if 'account' in kwargs.keys() and 'domainid' in kwargs.keys():
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
+ if 'account' in list(kwargs.keys()) and 'domainid' in list(kwargs.keys()):
cmd.listall=True
return(apiclient.listLoadBalancerRules(cmd))
@@ -856,8 +856,8 @@ def list_lb_instances(apiclient, **kwargs):
"""List all Load balancing instances matching criteria"""
cmd = listLoadBalancerRuleInstances.listLoadBalancerRuleInstancesCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
- if 'account' in kwargs.keys() and 'domainid' in kwargs.keys():
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
+ if 'account' in list(kwargs.keys()) and 'domainid' in list(kwargs.keys()):
cmd.listall=True
return(apiclient.listLoadBalancerRuleInstances(cmd))
@@ -866,8 +866,8 @@ def list_firewall_rules(apiclient, **kwargs):
"""List all Firewall Rules matching criteria"""
cmd = listFirewallRules.listFirewallRulesCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
- if 'account' in kwargs.keys() and 'domainid' in kwargs.keys():
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
+ if 'account' in list(kwargs.keys()) and 'domainid' in list(kwargs.keys()):
cmd.listall=True
return(apiclient.listFirewallRules(cmd))
@@ -876,8 +876,8 @@ def list_volumes(apiclient, **kwargs):
"""List all volumes matching criteria"""
cmd = listVolumes.listVolumesCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
- if 'account' in kwargs.keys() and 'domainid' in kwargs.keys():
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
+ if 'account' in list(kwargs.keys()) and 'domainid' in list(kwargs.keys()):
cmd.listall=True
return(apiclient.listVolumes(cmd))
@@ -886,8 +886,8 @@ def list_isos(apiclient, **kwargs):
"""Lists all available ISO files."""
cmd = listIsos.listIsosCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
- if 'account' in kwargs.keys() and 'domainid' in kwargs.keys():
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
+ if 'account' in list(kwargs.keys()) and 'domainid' in list(kwargs.keys()):
cmd.listall=True
return(apiclient.listIsos(cmd))
@@ -896,8 +896,8 @@ def list_snapshots(apiclient, **kwargs):
"""List all snapshots matching criteria"""
cmd = listSnapshots.listSnapshotsCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
- if 'account' in kwargs.keys() and 'domainid' in kwargs.keys():
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
+ if 'account' in list(kwargs.keys()) and 'domainid' in list(kwargs.keys()):
cmd.listall=True
return(apiclient.listSnapshots(cmd))
@@ -906,8 +906,8 @@ def list_templates(apiclient, **kwargs):
"""List all templates matching criteria"""
cmd = listTemplates.listTemplatesCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
- if 'account' in kwargs.keys() and 'domainid' in kwargs.keys():
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
+ if 'account' in list(kwargs.keys()) and 'domainid' in list(kwargs.keys()):
cmd.listall=True
return(apiclient.listTemplates(cmd))
@@ -916,8 +916,8 @@ def list_domains(apiclient, **kwargs):
"""Lists domains"""
cmd = listDomains.listDomainsCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
- if 'account' in kwargs.keys() and 'domainid' in kwargs.keys():
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
+ if 'account' in list(kwargs.keys()) and 'domainid' in list(kwargs.keys()):
cmd.listall=True
return(apiclient.listDomains(cmd))
@@ -927,8 +927,8 @@ def list_accounts(apiclient, **kwargs):
listed accounts"""
cmd = listAccounts.listAccountsCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
- if 'account' in kwargs.keys() and 'domainid' in kwargs.keys():
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
+ if 'account' in list(kwargs.keys()) and 'domainid' in list(kwargs.keys()):
cmd.listall=True
return(apiclient.listAccounts(cmd))
@@ -938,8 +938,8 @@ def list_users(apiclient, **kwargs):
listed users"""
cmd = listUsers.listUsersCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
- if 'account' in kwargs.keys() and 'domainid' in kwargs.keys():
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
+ if 'account' in list(kwargs.keys()) and 'domainid' in list(kwargs.keys()):
cmd.listall=True
return(apiclient.listUsers(cmd))
@@ -948,8 +948,8 @@ def list_snapshot_policy(apiclient, **kwargs):
"""Lists snapshot policies."""
cmd = listSnapshotPolicies.listSnapshotPoliciesCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
- if 'account' in kwargs.keys() and 'domainid' in kwargs.keys():
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
+ if 'account' in list(kwargs.keys()) and 'domainid' in list(kwargs.keys()):
cmd.listall=True
return(apiclient.listSnapshotPolicies(cmd))
@@ -958,8 +958,8 @@ def list_events(apiclient, **kwargs):
"""Lists events"""
cmd = listEvents.listEventsCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
- if 'account' in kwargs.keys() and 'domainid' in kwargs.keys():
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
+ if 'account' in list(kwargs.keys()) and 'domainid' in list(kwargs.keys()):
cmd.listall=True
return(apiclient.listEvents(cmd))
@@ -968,8 +968,8 @@ def list_disk_offering(apiclient, **kwargs):
"""Lists all available disk offerings."""
cmd = listDiskOfferings.listDiskOfferingsCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
- if 'account' in kwargs.keys() and 'domainid' in kwargs.keys():
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
+ if 'account' in list(kwargs.keys()) and 'domainid' in list(kwargs.keys()):
cmd.listall=True
return(apiclient.listDiskOfferings(cmd))
@@ -978,8 +978,8 @@ def list_service_offering(apiclient, **kwargs):
"""Lists all available service offerings."""
cmd = listServiceOfferings.listServiceOfferingsCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
- if 'account' in kwargs.keys() and 'domainid' in kwargs.keys():
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
+ if 'account' in list(kwargs.keys()) and 'domainid' in list(kwargs.keys()):
cmd.listall=True
return(apiclient.listServiceOfferings(cmd))
@@ -988,8 +988,8 @@ def list_vlan_ipranges(apiclient, **kwargs):
"""Lists all VLAN IP ranges."""
cmd = listVlanIpRanges.listVlanIpRangesCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
- if 'account' in kwargs.keys() and 'domainid' in kwargs.keys():
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
+ if 'account' in list(kwargs.keys()) and 'domainid' in list(kwargs.keys()):
cmd.listall=True
return(apiclient.listVlanIpRanges(cmd))
@@ -998,8 +998,8 @@ def list_usage_records(apiclient, **kwargs):
"""Lists usage records for accounts"""
cmd = listUsageRecords.listUsageRecordsCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
- if 'account' in kwargs.keys() and 'domainid' in kwargs.keys():
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
+ if 'account' in list(kwargs.keys()) and 'domainid' in list(kwargs.keys()):
cmd.listall=True
return(apiclient.listUsageRecords(cmd))
@@ -1008,8 +1008,8 @@ def list_nw_service_prividers(apiclient, **kwargs):
"""Lists Network service providers"""
cmd = listNetworkServiceProviders.listNetworkServiceProvidersCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
- if 'account' in kwargs.keys() and 'domainid' in kwargs.keys():
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
+ if 'account' in list(kwargs.keys()) and 'domainid' in list(kwargs.keys()):
cmd.listall=True
return(apiclient.listNetworkServiceProviders(cmd))
@@ -1018,8 +1018,8 @@ def list_virtual_router_elements(apiclient, **kwargs):
"""Lists Virtual Router elements"""
cmd = listVirtualRouterElements.listVirtualRouterElementsCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
- if 'account' in kwargs.keys() and 'domainid' in kwargs.keys():
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
+ if 'account' in list(kwargs.keys()) and 'domainid' in list(kwargs.keys()):
cmd.listall=True
return(apiclient.listVirtualRouterElements(cmd))
@@ -1028,8 +1028,8 @@ def list_network_offerings(apiclient, **kwargs):
"""Lists network offerings"""
cmd = listNetworkOfferings.listNetworkOfferingsCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
- if 'account' in kwargs.keys() and 'domainid' in kwargs.keys():
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
+ if 'account' in list(kwargs.keys()) and 'domainid' in list(kwargs.keys()):
cmd.listall=True
return(apiclient.listNetworkOfferings(cmd))
@@ -1038,8 +1038,8 @@ def list_resource_limits(apiclient, **kwargs):
"""Lists resource limits"""
cmd = listResourceLimits.listResourceLimitsCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
- if 'account' in kwargs.keys() and 'domainid' in kwargs.keys():
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
+ if 'account' in list(kwargs.keys()) and 'domainid' in list(kwargs.keys()):
cmd.listall=True
return(apiclient.listResourceLimits(cmd))
@@ -1048,8 +1048,8 @@ def list_vpc_offerings(apiclient, **kwargs):
""" Lists VPC offerings """
cmd = listVPCOfferings.listVPCOfferingsCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
- if 'account' in kwargs.keys() and 'domainid' in kwargs.keys():
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
+ if 'account' in list(kwargs.keys()) and 'domainid' in list(kwargs.keys()):
cmd.listall=True
return(apiclient.listVPCOfferings(cmd))
@@ -2076,7 +2076,7 @@ def verifyVCenterPortGroups(
dvPortGroups = response[1]
expectedDVPortGroupNames.extend(dvPortGroups)
- vcenterPortGroups = list(itertools.chain(*(switchDict.values())))
+ vcenterPortGroups = list(itertools.chain(*(list(switchDict.values()))))
for expectedDVPortGroupName in expectedDVPortGroupNames:
assert expectedDVPortGroupName in vcenterPortGroups,\
diff --git a/tools/marvin/marvin/lib/ncc.py b/tools/marvin/marvin/lib/ncc.py
index 5c0ae32f383f..7144558d8e11 100755
--- a/tools/marvin/marvin/lib/ncc.py
+++ b/tools/marvin/marvin/lib/ncc.py
@@ -27,7 +27,7 @@
GetDetailExceptionInfo)
from os import system
from subprocess import call
-import requests, json, urllib
+import requests, json, urllib.request, urllib.parse, urllib.error
class NCC:
diff --git a/tools/marvin/marvin/lib/utils.py b/tools/marvin/marvin/lib/utils.py
index f170e0dc3bf6..f9036616fd9f 100644
--- a/tools/marvin/marvin/lib/utils.py
+++ b/tools/marvin/marvin/lib/utils.py
@@ -27,7 +27,7 @@
import imaplib
import email
import socket
-import urlparse
+import urllib.parse
import datetime
from marvin.cloudstackAPI import cloudstackAPIClient, listHosts, listRouters
from platform import system
@@ -181,7 +181,7 @@ def is_server_ssh_ready(ipaddress, port, username, password, retries=20, retryin
retries=retries,
delay=retryinterv,
timeout=timeout)
- except Exception, e:
+ except Exception as e:
raise Exception("SSH connection has Failed. Waited %ss. Error is %s" % (retries * retryinterv, str(e)))
else:
return ssh
@@ -220,13 +220,13 @@ def get_host_credentials(config, hostip):
for cluster in pod.clusters:
for host in cluster.hosts:
if str(host.url).startswith('http'):
- hostname = urlparse.urlsplit(str(host.url)).netloc
+ hostname = urllib.parse.urlsplit(str(host.url)).netloc
else:
hostname = str(host.url)
try:
if socket.getfqdn(hostip) == socket.getfqdn(hostname):
return host.username, host.password
- except socket.error, e:
+ except socket.error as e:
raise Exception("Unresolvable host %s error is %s" % (hostip, e))
raise KeyError("Please provide the marvin configuration file with credentials to your hosts")
@@ -322,7 +322,7 @@ def is_snapshot_on_nfs(apiclient, dbconn, config, zoneid, snapshotid):
#Snapshot does not exist
return False
- from base import ImageStore
+ from .base import ImageStore
#pass store_id to get the exact storage pool where snapshot is stored
secondaryStores = ImageStore.list(apiclient, zoneid=zoneid, id=int(qresultset[0][1]))
@@ -341,7 +341,7 @@ def is_snapshot_on_nfs(apiclient, dbconn, config, zoneid, snapshotid):
nfsurl = secondaryStore.url
from urllib2 import urlparse
- parse_url = urlparse.urlsplit(nfsurl, scheme='nfs')
+ parse_url = urllib.parse.urlsplit(nfsurl, scheme='nfs')
host, path = str(parse_url.netloc), str(parse_url.path)
if not config.mgtSvr:
@@ -502,9 +502,9 @@ def checkVolumeSize(ssh_handle=None,
if m and str(m.group(1)) == str(size_to_verify):
return [SUCCESS,str(m.group(1))]
return [FAILED,"Volume Not Found"]
- except Exception, e:
- print "\n Exception Occurred under getDiskUsage: " \
- "%s" %GetDetailExceptionInfo(e)
+ except Exception as e:
+ print(("\n Exception Occurred under getDiskUsage: " \
+ "%s" %GetDetailExceptionInfo(e)))
return [FAILED,GetDetailExceptionInfo(e)]
diff --git a/tools/marvin/marvin/lib/vcenter.py b/tools/marvin/marvin/lib/vcenter.py
index 78ca50e19d87..d19afd312b55 100644
--- a/tools/marvin/marvin/lib/vcenter.py
+++ b/tools/marvin/marvin/lib/vcenter.py
@@ -279,7 +279,7 @@ def add_host(self, cluster, hostname, sslthumbprint, username, password):
force=True)
task = cluster.AddHost(spec=hostspec, asConnected=True)
except Exception as e:
- print "Error adding host :%s" % e
+ print("Error adding host :%s" % e)
self.wait_for_task(task)
host = self._get_obj([vim.HostSystem], hostname)
return host
@@ -316,7 +316,7 @@ def create_datacenters(self, config):
username=user,
password=passwd)
except Exception as e:
- print "Failed to create datacenter: %s" % e
+ print("Failed to create datacenter: %s" % e)
def wait_for_task(self, task):
@@ -326,7 +326,7 @@ def wait_for_task(self, task):
if task.info.state == vim.TaskInfo.State.success:
if task.info.result is not None:
out = 'Task completed successfully, result: %s' % (task.info.result,)
- print out
+ print(out)
elif task.info.state == vim.TaskInfo.State.error:
out = 'Error - Task did not complete successfully: %s' % (task.info.error,)
raise ValueError(out)
@@ -353,30 +353,30 @@ def getsslThumbprint(self,ip):
vc_object = Vcenter("10.x.x.x", "username", "password")
- print '###get one dc########'
- print(vc_object.get_datacenters(name='testDC'))
+ print('###get one dc########')
+ print((vc_object.get_datacenters(name='testDC')))
- print '###get multiple dcs########'
+ print('###get multiple dcs########')
for i in vc_object.get_datacenters():
print(i)
- print '###get one dv########'
- print vc_object.get_dvswitches(name='dvSwitch')
+ print('###get one dv########')
+ print(vc_object.get_dvswitches(name='dvSwitch'))
- print '###get multiple dvs########'
+ print('###get multiple dvs########')
for i in vc_object.get_dvswitches():
print(i)
- print '###get one dvportgroup########'
- print(vc_object.get_dvportgroups(name='cloud.guest.207.200.1-dvSwitch'))
+ print('###get one dvportgroup########')
+ print((vc_object.get_dvportgroups(name='cloud.guest.207.200.1-dvSwitch')))
- print "###get one dvportgroup and the vms associated with it########"
+ print("###get one dvportgroup and the vms associated with it########")
for vm in vc_object.get_dvportgroups(name='cloud.guest.207.200.1-dvSwitch')[0]['dvportgroup']['vmlist']:
- print(vm.name)
- print(vm.network)
+ print((vm.name))
+ print((vm.network))
- print '###get multiple dvportgroups########'
+ print('###get multiple dvportgroups########')
for i in vc_object.get_dvportgroups():
print(i)
- print vc_object.get_vms(name='VM1')
+ print(vc_object.get_vms(name='VM1'))
diff --git a/tools/marvin/marvin/marvinInit.py b/tools/marvin/marvin/marvinInit.py
index c6ee1a2c7ad9..234e930837eb 100644
--- a/tools/marvin/marvin/marvinInit.py
+++ b/tools/marvin/marvin/marvinInit.py
@@ -67,14 +67,14 @@ def __parseConfig(self):
'''
try:
if not os.path.isfile(self.__configFile):
- print "\n=== Marvin Parse Config Init Failed ==="
+ print("\n=== Marvin Parse Config Init Failed ===")
return FAILED
self.__parsedConfig = getSetupConfig(self.__configFile)
- print "\n=== Marvin Parse Config Successful ==="
+ print("\n=== Marvin Parse Config Successful ===")
return SUCCESS
except Exception as e:
- print "\nException Occurred Under __parseConfig : " \
- "%s" % GetDetailExceptionInfo(e)
+ print("\nException Occurred Under __parseConfig : " \
+ "%s" % GetDetailExceptionInfo(e))
return FAILED
def getParsedConfig(self):
@@ -126,8 +126,8 @@ def __setHypervisorAndZoneInfo(self):
self.__hypervisorType = XEN_SERVER
return SUCCESS
except Exception as e:
- print "\n Exception Occurred Under init " \
- "%s" % GetDetailExceptionInfo(e)
+ print("\n Exception Occurred Under init " \
+ "%s" % GetDetailExceptionInfo(e))
return FAILED
def init(self):
@@ -142,20 +142,20 @@ def init(self):
@Output : SUCCESS or FAILED
'''
try:
- print "\n==== Marvin Init Started ===="
+ print("\n==== Marvin Init Started ====")
if ((self.__parseConfig() != FAILED) and
(self.__setHypervisorAndZoneInfo())and
(self.__setTestDataPath() != FAILED) and
(self.__initLogging() != FAILED) and
(self.__createTestClient() != FAILED) and
(self.__deployDC() != FAILED)):
- print "\n==== Marvin Init Successful ===="
+ print("\n==== Marvin Init Successful ====")
return SUCCESS
- print "\n==== Marvin Init Failed ===="
+ print("\n==== Marvin Init Failed ====")
return FAILED
except Exception as e:
- print "\n Exception Occurred Under init " \
- "%s" % GetDetailExceptionInfo(e)
+ print("\n Exception Occurred Under init " \
+ "%s" % GetDetailExceptionInfo(e))
return FAILED
def __initLogging(self):
@@ -181,12 +181,12 @@ def __initLogging(self):
if ret != FAILED:
self.__logFolderPath = log_obj.getLogFolderPath()
self.__tcRunLogger = log_obj.getLogger()
- print "\n=== Marvin Init Logging Successful==="
+ print("\n=== Marvin Init Logging Successful===")
return SUCCESS
return FAILED
except Exception as e:
- print "\n Exception Occurred Under __initLogging " \
- ":%s" % GetDetailExceptionInfo(e)
+ print("\n Exception Occurred Under __initLogging " \
+ ":%s" % GetDetailExceptionInfo(e))
return FAILED
def __createTestClient(self):
@@ -210,8 +210,8 @@ def __createTestClient(self):
return self.__testClient.createTestClient()
return FAILED
except Exception as e:
- print "\n Exception Occurred Under __createTestClient : %s" % \
- GetDetailExceptionInfo(e)
+ print("\n Exception Occurred Under __createTestClient : %s" % \
+ GetDetailExceptionInfo(e))
return FAILED
def __setTestDataPath(self):
@@ -224,11 +224,11 @@ def __setTestDataPath(self):
if ((self.__parsedConfig.TestData is not None) and
(self.__parsedConfig.TestData.Path is not None)):
self.__testDataFilePath = self.__parsedConfig.TestData.Path
- print "\n=== Marvin Setting TestData Successful==="
+ print("\n=== Marvin Setting TestData Successful===")
return SUCCESS
except Exception as e:
- print "\nException Occurred Under __setTestDataPath : %s" % \
- GetDetailExceptionInfo(e)
+ print("\nException Occurred Under __setTestDataPath : %s" % \
+ GetDetailExceptionInfo(e))
return FAILED
def __deployDC(self):
@@ -245,9 +245,9 @@ def __deployDC(self):
self.__tcRunLogger)
ret = deploy_obj.deploy()
if ret != SUCCESS:
- print "==== Deploy DC Failed ===="
+ print("==== Deploy DC Failed ====")
return ret
except Exception as e:
- print "\n Exception Occurred Under __deployDC : %s" % \
- GetDetailExceptionInfo(e)
+ print("\n Exception Occurred Under __deployDC : %s" % \
+ GetDetailExceptionInfo(e))
return FAILED
diff --git a/tools/marvin/marvin/marvinLog.py b/tools/marvin/marvin/marvinLog.py
index 582d2e144578..c720186172bd 100644
--- a/tools/marvin/marvin/marvinLog.py
+++ b/tools/marvin/marvin/marvinLog.py
@@ -40,7 +40,7 @@ class MarvinLog:
def __new__(cls, logger_name):
if not cls._instance:
- cls._instance = super(MarvinLog, cls).__new__(cls, logger_name)
+ cls._instance = super(MarvinLog, cls).__new__(cls)
return cls._instance
def __init__(self, logger_name):
@@ -92,8 +92,8 @@ def __setLogHandler(self, log_file_path,
self.__logger.addHandler(stream)
return SUCCESS
except Exception as e:
- print "\nException Occurred Under " \
- "__setLogHandler %s" % GetDetailExceptionInfo(e)
+ print("\nException Occurred Under " \
+ "__setLogHandler %s" % GetDetailExceptionInfo(e))
return FAILED
def __cleanPreviousLogs(self, logfolder_to_remove):
@@ -107,8 +107,8 @@ def __cleanPreviousLogs(self, logfolder_to_remove):
if os.path.isdir(logfolder_to_remove):
os.rmdir(logfolder_to_remove)
except Exception as e:
- print "\n Exception Occurred Under __cleanPreviousLogs :%s" % \
- GetDetailExceptionInfo(e)
+ print("\n Exception Occurred Under __cleanPreviousLogs :%s" % \
+ GetDetailExceptionInfo(e))
return FAILED
def getLogger(self):
@@ -155,7 +155,7 @@ def createLogs(self,
if user_provided_logpath:
temp_dir = os.path.join(user_provided_logpath, "MarvinLogs")
elif ((log_cfg is not None) and
- ('LogFolderPath' in log_cfg.__dict__.keys()) and
+ ('LogFolderPath' in list(log_cfg.__dict__.keys())) and
(log_cfg.__dict__.get('LogFolderPath') is not None)):
temp_dir = os.path.join(log_cfg.__dict__.get('LogFolderPath'), "MarvinLogs")
@@ -167,7 +167,7 @@ def createLogs(self,
else:
self.__logFolderDir = os.path.join(temp_dir, str(test_module_name))
- print "\n==== Log Folder Path: %s. All logs will be available here ====" % str(self.__logFolderDir)
+ print("\n==== Log Folder Path: %s. All logs will be available here ====" % str(self.__logFolderDir))
os.makedirs(self.__logFolderDir)
'''
@@ -187,6 +187,6 @@ def createLogs(self,
return SUCCESS
return FAILED
except Exception as e:
- print "\n Exception Occurred Under createLogs :%s" % \
- GetDetailExceptionInfo(e)
+ print("\n Exception Occurred Under createLogs :%s" % \
+ GetDetailExceptionInfo(e))
return FAILED
diff --git a/tools/marvin/marvin/marvinPlugin.py b/tools/marvin/marvin/marvinPlugin.py
index bd55763cabd7..327b799b8df6 100644
--- a/tools/marvin/marvin/marvinPlugin.py
+++ b/tools/marvin/marvin/marvinPlugin.py
@@ -14,15 +14,12 @@
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
-import marvin
from sys import stdout, exit
-import logging
import time
import os
-import nose.core
from marvin.cloudstackTestCase import cloudstackTestCase
from marvin.marvinInit import MarvinInit
-from nose.plugins.base import Plugin
+from nose2 import events, runner
from marvin.codes import (SUCCESS,
FAILED,
EXCEPTION)
@@ -30,15 +27,24 @@
from marvin.cloudstackException import GetDetailExceptionInfo
-class MarvinPlugin(Plugin):
+class MarvinPlugin(events.Plugin):
"""
Custom plugin for the cloudstackTestCases to be run using nose
"""
+ enableOpt = 'with-marvin'
+ deployOpt = 'deploy'
+ zoneOpt = 'zone'
+ hypervisorOpt = 'hypervisor'
+ configOpt = 'marvin_config'
+ logFolderOpt = 'log_folder_path'
+ commandLineSwitch = (None, enableOpt, 'marvin test plugin')
+ configSection = 'marvin'
name = "marvin"
def __init__(self):
+ self.options()
self.__identifier = None
self.__testClient = None
self.__logFolderPath = None
@@ -54,7 +60,7 @@ def __init__(self):
'''
Signifies the flag whether to deploy the New DC or Not
'''
- self.__deployDcFlag = None
+ self.__deployDcFlag = False
self.conf = None
self.__resultStream = stdout
self.__testRunner = None
@@ -70,60 +76,81 @@ def __init__(self):
self.__userLogPath = None
Plugin.__init__(self)
- def configure(self, options, conf):
- """enable the marvin plugin when the --with-marvin directive is given
+ def handleArgs(self, event):
+ """Get our options in order command line, config file, hard coded.
+ enable the marvin plugin when the --with-marvin directive is given
to nose. The enableOpt value is set from the command line directive and
self.enabled (True|False) determines whether marvin's tests will run.
By default non-default plugins like marvin will be disabled
"""
self.enabled = True
- if hasattr(options, self.enableOpt):
- if not getattr(options, self.enableOpt):
+ if hasattr(event.args, self.enableOpt):
+ if not getattr(event.args, self.enableOpt):
self.enabled = False
return
- self.__configFile = options.configFile
- self.__deployDcFlag = options.deployDc
- self.__zoneForTests = options.zone
- self.__hypervisorType = options.hypervisor_type
- self.__userLogPath = options.logFolder
- self.conf = conf
- if self.startMarvin() == FAILED:
- print "\nStarting Marvin Failed, exiting. Please Check"
- exit(1)
+ if hasattr(event.args, self.configOpt):
+ if getattr(event.args, self.configOpt):
+ self.__configFile = event.args.marvin_config[0]
+ if hasattr(event.args, self.deployOpt):
+ if getattr(event.args, self.deployOpt):
+ self.__deployDcFlag = True
+ if hasattr(event.args, self.zoneOpt):
+ if getattr(event.args, self.zoneOpt):
+ self.__zoneForTests = event.args.zone
+ if hasattr(event.args, self.hypervisorOpt):
+ if getattr(event.args, self.hypervisorOpt):
+ self.setHypervisor(event.args.hypervisor)
+ if hasattr(event.args, self.logFolderOpt):
+ if getattr(event.args, self.logFolderOpt):
+ self.setHypervisor(event.args.logFolder)
+ # TODO handle config file config linkAccount self.conf = conf
+ if self.__configFile:
+ if self.startMarvin() == FAILED:
+ print("\nStarting Marvin Failed, exiting. Please Check")
+ exit(1)
+ else:
+ print("\nNo marvin config yet, postponing start")
- def options(self, parser, env):
+ def options(self):
"""
Register command line options
"""
- parser.add_option("--marvin-config", action="store",
- default=env.get('MARVIN_CONFIG',
- './datacenter.cfg'),
- dest="configFile",
- help="Marvin's configuration file is required."
- "The config file containing the datacenter and "
- "other management server "
- "information is specified")
- parser.add_option("--deploy", action="store_true",
- default=False,
- dest="deployDc",
- help="Deploys the DC with Given Configuration."
- "Requires only when DC needs to be deployed")
- parser.add_option("--zone", action="store",
- default=None,
- dest="zone",
- help="Runs all tests against this specified zone")
- parser.add_option("--hypervisor", action="store",
- default=None,
- dest="hypervisor_type",
- help="Runs all tests against the specified "
- "zone and hypervisor Type")
- parser.add_option("--log-folder-path", action="store",
- default=None,
- dest="logFolder",
- help="Collects all logs under the user specified"
- "folder"
- )
- Plugin.options(self, parser, env)
+ """
+ TODO missing is the default=env.get('MARVIN_CONFIG',
+ './datacenter.cfg'),
+ """
+ self.addArgument(self.setConfigFile, short_opt="M", long_opt=self.configOpt.replace("_","-"),
+ help_text="Marvin's configuration file is required."
+ "The config file containing the datacenter and "
+ "other management server information is specified")
+ self.addFlag(self.enableDeploy, short_opt="R", long_opt=self.deployOpt,
+ help_text="Deploys the DC (Region) with Given Configuration."
+ "Required only when DC needs to be deployed")
+ self.addArgument(self.setZone, short_opt="Z", long_opt=self.zoneOpt,
+ help_text="Runs all tests against this specified zone")
+ self.addArgument(self.setHypervisor, short_opt="H", long_opt=self.hypervisorOpt,
+ help_text="Runs all tests against the specified zone and hypervisor Type")
+ self.addArgument(self.setLogFolder, short_opt="L", long_opt=self.logFolderOpt.replace("_","-"),
+ help_text="Collects all logs under the user specified folder")
+
+ def setConfigFile(self, filePath):
+ if filePath != None:
+ self.__configFile = filePath
+
+ def setZone(self, zone):
+ if zone != None:
+ self.__zoneForTests = zone
+
+ def setHypervisor(self, hypervisor):
+ if hypervisor != None:
+ self.__hypervisorType = hypervisor
+
+ def setLogFolder(self,folder):
+ if folder != None:
+ self.__logFolderPath = folder
+
+ def enableDeploy(self):
+ self.__deployDcFlag = True
def wantClass(self, cls):
if cls.__name__ == 'cloudstackTestCase':
@@ -150,8 +177,8 @@ def __checkImport(self, filename):
return True
return False
except ImportError as e:
- print "FileName :%s : Error : %s" % \
- (filename, GetDetailExceptionInfo(e))
+ print(("FileName :%s : Error : %s" % \
+ (filename, GetDetailExceptionInfo(e))))
return False
def wantFile(self, filename):
@@ -161,9 +188,9 @@ def wantFile(self, filename):
return self.__checkImport(filename)
def loadTestsFromTestCase(self, cls):
- if cls.__name__ != 'cloudstackTestCase':
- self.__identifier = cls.__name__
- self._injectClients(cls)
+ if cls.testCase and cls.testCase.__name__ != 'cloudstackTestCase':
+ self.__identifier = cls.testCase.__name__
+ self._injectClients(cls.testCase)
def beforeTest(self, test):
self.__testModName = test.__str__()
@@ -193,7 +220,7 @@ def printMsg(self, status, tname, err):
GetDetailExceptionInfo(err)))
write_str = "=== TestName: %s | Status : %s ===\n" % (tname, status)
self.__resultStream.write(write_str)
- print write_str
+ print(write_str)
def addSuccess(self, test, capt):
'''
@@ -242,16 +269,15 @@ def startMarvin(self):
self.__parsedConfig = obj_marvininit.getParsedConfig()
self.__resultStream = obj_marvininit.getResultFile()
self.__logFolderPath = obj_marvininit.getLogFolderPath()
- self.__testRunner = nose.core.\
- TextTestRunner(stream=self.__resultStream,
- descriptions=True,
- verbosity=2,
- config=self.conf)
+ # self.__testRunner = runner.PluggableTestRunner(stream=self.__resultStream,
+ # descriptions=True,
+ # verbosity=2,
+ # config=self.conf)
return SUCCESS
return FAILED
except Exception as e:
- print "Exception Occurred under startMarvin: %s" % \
- GetDetailExceptionInfo(e)
+ print(("Exception Occurred under startMarvin: %s" % \
+ GetDetailExceptionInfo(e)))
return FAILED
def stopTest(self, test):
@@ -306,7 +332,7 @@ def finalize(self, result):
dst = tmp + "/" + mod_name + "_" + random_gen()
cmd = "mv " + src + " " + dst
os.system(cmd)
- print "===final results are now copied to: %s===" % str(dst)
+ print(("===final results are now copied to: %s===" % str(dst)))
except Exception as e:
- print "=== Exception occurred under finalize :%s ===" % \
- str(GetDetailExceptionInfo(e))
+ print(("=== Exception occurred under finalize :%s ===" % \
+ str(GetDetailExceptionInfo(e))))
diff --git a/tools/marvin/marvin/misc/build/advanced_env.py b/tools/marvin/marvin/misc/build/advanced_env.py
index 07991f1f408a..659480056af6 100644
--- a/tools/marvin/marvin/misc/build/advanced_env.py
+++ b/tools/marvin/marvin/misc/build/advanced_env.py
@@ -27,13 +27,13 @@
'''
import random
import marvin
-from ConfigParser import SafeConfigParser
+from configparser import SafeConfigParser
from optparse import OptionParser
from marvin.configGenerator import *
def getGlobalSettings(config):
- for k, v in dict(config.items('globals')).iteritems():
+ for k, v in dict(config.items('globals')).items():
cfg = configuration()
cfg.name = k
cfg.value = v
diff --git a/tools/marvin/marvin/misc/build/bashUtils.py b/tools/marvin/marvin/misc/build/bashUtils.py
index d4e74f3a6f74..c07c9b3bb71f 100644
--- a/tools/marvin/marvin/misc/build/bashUtils.py
+++ b/tools/marvin/marvin/misc/build/bashUtils.py
@@ -42,7 +42,7 @@ def __init__(self, host, port, user, passwd):
self.ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
try:
self.ssh.connect(str(host),int(port), user, passwd)
- except paramiko.SSHException, sshex:
+ except paramiko.SSHException as sshex:
logging.debug(repr(sshex))
def execute(self, command):
@@ -70,7 +70,7 @@ def execute_buffered(self, command, bufsize=512):
rl, wl, xl = select.select([channel],[],[],0.0)
if len(rl) > 0:
logging.debug(channel.recv(bufsize))
- except paramiko.SSHException, e:
+ except paramiko.SSHException as e:
logging.debug(repr(e))
@@ -80,7 +80,7 @@ def scp(self, srcFile, destPath):
sftp = paramiko.SFTPClient.from_transport(transport)
try:
sftp.put(srcFile, destPath)
- except IOError, e:
+ except IOError as e:
raise e
class bash:
diff --git a/tools/marvin/marvin/misc/build/buildGenerator.py b/tools/marvin/marvin/misc/build/buildGenerator.py
index 579406790c89..bb92b7f32e9a 100644
--- a/tools/marvin/marvin/misc/build/buildGenerator.py
+++ b/tools/marvin/marvin/misc/build/buildGenerator.py
@@ -18,7 +18,7 @@
# under the License.
-from ConfigParser import ConfigParser
+from configparser import ConfigParser
from jenkinsapi import api, jenkins, job
from time import sleep as delay
import jenkinsapi
@@ -49,7 +49,7 @@ def __init__(self, username=None, passwd=None, url="http://hudson.lab.vmops.com"
try:
j = jenkins.Jenkins(self.hudsonurl, self.username, self.password)
self.jobclient = j.get_job(job)
- except Exception, e:
+ except Exception as e:
logging.error("Failed to login to Hudson")
raise e
else:
@@ -71,7 +71,7 @@ def parseConfigParams(self):
params = {}
if self.config:
logging.debug("build params found:")
- for k,v in dict(self.config.items('build_params')).iteritems():
+ for k,v in dict(self.config.items('build_params')).items():
logging.debug("%s : %s"%(k,v))
return dict(self.config.items('build_params'))
else:
@@ -141,7 +141,7 @@ def sift(self, dic):
def getBuildParamList(self, bld):
params = bld.get_actions()['parameters']
- return dict(map(self.sift, params))
+ return dict(list(map(self.sift, params)))
def resolveRepoPath(self):
tarball_list = ['CloudStack-' ,
diff --git a/tools/marvin/marvin/misc/build/configure.py b/tools/marvin/marvin/misc/build/configure.py
index 22d1880b8f31..07dae947d365 100644
--- a/tools/marvin/marvin/misc/build/configure.py
+++ b/tools/marvin/marvin/misc/build/configure.py
@@ -15,7 +15,7 @@
# specific language governing permissions and limitations
# under the License.
-from ConfigParser import ConfigParser
+from configparser import ConfigParser
from bashUtils import bash
from marvin import configGenerator
from marvin import sshClient
@@ -28,12 +28,12 @@
import telnetlib
import logging
import threading
-import Queue
+import queue
import sys
import random
import string
-import urllib2
-import urlparse
+import urllib.request, urllib.error, urllib.parse
+import urllib.parse
import socket
WORKSPACE="."
@@ -83,11 +83,11 @@ def mkdirs(path):
def fetch(filename, url, path):
try:
- zipstream = urllib2.urlopen(url)
+ zipstream = urllib.request.urlopen(url)
tarball = open('/tmp/%s' % filename, 'wb')
tarball.write(zipstream.read())
tarball.close()
- except urllib2.URLError, u:
+ except urllib.error.URLError as u:
raise u
except IOError:
raise
@@ -95,7 +95,7 @@ def fetch(filename, url, path):
def cobblerHomeResolve(ip_address, param="gateway"):
ipAddr = IPAddress(ip_address)
- for nic, network in cobblerinfo.items():
+ for nic, network in list(cobblerinfo.items()):
subnet = IPNetwork(cobblerinfo[nic]["network"])
if ipAddr in subnet:
return cobblerinfo[nic][param]
@@ -142,7 +142,7 @@ def mountAndClean(host, path):
Will mount and clear the files on NFS host in the path given. Obviously the
NFS server should be mountable where this script runs
"""
- mnt_path = "/tmp/" + ''.join([random.choice(string.ascii_uppercase) for x in xrange(0, 10)])
+ mnt_path = "/tmp/" + ''.join([random.choice(string.ascii_uppercase) for x in range(0, 10)])
mkdirs(mnt_path)
logging.info("cleaning up %s:%s" % (host, path))
mnt = bash("mount -t nfs %s:%s %s" % (host, path, mnt_path))
@@ -157,8 +157,8 @@ def cleanPrimaryStorage(cscfg):
for pod in zone.pods:
for cluster in pod.clusters:
for primaryStorage in cluster.primaryStorages:
- if urlparse.urlsplit(primaryStorage.url).scheme == "nfs":
- mountAndClean(urlparse.urlsplit(primaryStorage.url).hostname, urlparse.urlsplit(primaryStorage.url).path)
+ if urllib.parse.urlsplit(primaryStorage.url).scheme == "nfs":
+ mountAndClean(urllib.parse.urlsplit(primaryStorage.url).hostname, urllib.parse.urlsplit(primaryStorage.url).path)
logging.info("Cleaned up primary stores")
def seedSecondaryStorage(cscfg, hypervisor):
@@ -172,8 +172,8 @@ def seedSecondaryStorage(cscfg, hypervisor):
bash("rm -f /etc/puppet/modules/cloudstack/files/secseeder.sh")
for zone in cscfg.zones:
for sstor in zone.secondaryStorages:
- shost = urlparse.urlsplit(sstor.url).hostname
- spath = urlparse.urlsplit(sstor.url).path
+ shost = urllib.parse.urlsplit(sstor.url).hostname
+ spath = urllib.parse.urlsplit(sstor.url).path
spath = ''.join([shost, ':', spath])
logging.info("seeding %s systemvm template on %s"%(hypervisor, spath))
bash("echo '/bin/bash /root/redeploy.sh -s %s -h %s' >> /etc/puppet/modules/cloudstack/files/secseeder.sh"%(spath, hypervisor))
@@ -189,7 +189,7 @@ def refreshHosts(cscfg, hypervisor="xenserver", profile="xenserver602"):
for pod in zone.pods:
for cluster in pod.clusters:
for host in cluster.hosts:
- hostname = urlparse.urlsplit(host.url).hostname
+ hostname = urllib.parse.urlsplit(host.url).hostname
logging.debug("attempting to refresh host %s"%hostname)
#revoke certs
bash("puppet cert clean %s.%s"%(hostname, DOMAIN))
@@ -234,7 +234,7 @@ def _isPortListening(host, port, timeout=120):
try:
tn = telnetlib.Telnet(host, port, timeout=timeout)
timeout = 0
- except Exception, e:
+ except Exception as e:
logging.debug("Failed to telnet connect to %s:%s with %s"%(host, port, e))
delay(5)
timeout = timeout - 5
@@ -257,7 +257,7 @@ def _isPortOpen(hostQueue, port=22):
try:
logging.debug("Attempting port=%s connect to host %s"%(port, host))
err = channel.connect_ex((host, port))
- except socket.error, e:
+ except socket.error as e:
logging.debug("encountered %s retrying in 5s"%e)
err = e.errno
delay(5)
@@ -274,7 +274,7 @@ def _isPortOpen(hostQueue, port=22):
def waitForHostReady(hostlist):
logging.info("Waiting for hosts %s to refresh"%hostlist)
- hostQueue = Queue.Queue()
+ hostQueue = queue.Queue()
for host in hostlist:
t = threading.Thread(name='HostWait-%s'%hostlist.index(host), target=_isPortOpen,
@@ -375,7 +375,7 @@ def init(lvl=logging.INFO):
try:
with open(options.system, 'r') as cfg:
system.readfp(cfg)
- except IOError, e:
+ except IOError as e:
logging.error("Specify a valid path for the environment properties")
raise e
generate_system_tables(system)
diff --git a/tools/marvin/marvin/misc/build/openport.py b/tools/marvin/marvin/misc/build/openport.py
index 0c40b0ab684a..0c3378b906d7 100644
--- a/tools/marvin/marvin/misc/build/openport.py
+++ b/tools/marvin/marvin/misc/build/openport.py
@@ -24,9 +24,9 @@ def _openIntegrationPort():
dbpasswd = 'cloud'#csconfig.dbSvr.passwd
conn = dbConnection.dbConnection(dbhost, 3306, dbuser, dbpasswd, "cloud")
query = "update configuration set value='8096' where name='integration.api.port'"
- print conn.execute(query)
+ print(conn.execute(query))
query = "select name,value from configuration where name='integration.api.port'"
- print conn.execute(query)
+ print(conn.execute(query))
if __name__ == '__main__':
_openIntegrationPort()
diff --git a/tools/marvin/marvin/misc/build/restartMgmt.py b/tools/marvin/marvin/misc/build/restartMgmt.py
index be5c76abdedb..ab5c0fc9e336 100644
--- a/tools/marvin/marvin/misc/build/restartMgmt.py
+++ b/tools/marvin/marvin/misc/build/restartMgmt.py
@@ -15,7 +15,7 @@
# specific language governing permissions and limitations
# under the License.
-from ConfigParser import ConfigParser
+from configparser import ConfigParser
from optparse import OptionParser
import marvin
from marvin import configGenerator
diff --git a/tools/marvin/marvin/misc/build/xunitmp/xunitmultiprocess.py b/tools/marvin/marvin/misc/build/xunitmp/xunitmultiprocess.py
index e119752689e8..5bbbb69c1f8a 100644
--- a/tools/marvin/marvin/misc/build/xunitmp/xunitmultiprocess.py
+++ b/tools/marvin/marvin/misc/build/xunitmp/xunitmultiprocess.py
@@ -116,7 +116,7 @@ def exc_message(exc_info):
result = str(exc)
except UnicodeEncodeError:
try:
- result = unicode(exc)
+ result = str(exc)
except UnicodeError:
# Fallback to args as neither str nor
# unicode(Exception(u'\xe6')) work in Python < 2.6
@@ -145,7 +145,7 @@ def _timeTaken(self):
def _quoteattr(self, attr):
"""Escape an XML attribute. Value can be unicode."""
attr = xml_safe(attr)
- if isinstance(attr, unicode) and not UNICODE_STRINGS:
+ if isinstance(attr, str) and not UNICODE_STRINGS:
attr = attr.encode(self.encoding)
return saxutils.quoteattr(attr)
@@ -213,8 +213,8 @@ def startTest(self, test):
def addstream(self,xml):
try:
self.xunitstream.append(xml)
- except Exception, e:
- print 'xunitmultiprocess add stream len=%d,%s'%(len(xml),str(e))
+ except Exception as e:
+ print('xunitmultiprocess add stream len=%d,%s'%(len(xml),str(e)))
def addError(self, test, err, capt=None):
"""Add error output to Xunit report.
diff --git a/tools/marvin/marvin/sandbox/advanced/advanced_env.py b/tools/marvin/marvin/sandbox/advanced/advanced_env.py
index f3d30643f217..8b6c3978b91a 100644
--- a/tools/marvin/marvin/sandbox/advanced/advanced_env.py
+++ b/tools/marvin/marvin/sandbox/advanced/advanced_env.py
@@ -24,13 +24,13 @@
'''
import random
import marvin
-from ConfigParser import SafeConfigParser
+from configparser import SafeConfigParser
from optparse import OptionParser
from marvin.configGenerator import *
def getGlobalSettings(config):
- for k, v in dict(config.items('globals')).iteritems():
+ for k, v in dict(config.items('globals')).items():
cfg = configuration()
cfg.name = k
cfg.value = v
diff --git a/tools/marvin/marvin/sandbox/advancedsg/advancedsg_env.py b/tools/marvin/marvin/sandbox/advancedsg/advancedsg_env.py
index 284ea2eb25b0..e5cc22a317d2 100644
--- a/tools/marvin/marvin/sandbox/advancedsg/advancedsg_env.py
+++ b/tools/marvin/marvin/sandbox/advancedsg/advancedsg_env.py
@@ -24,13 +24,13 @@
'''
import random
import marvin
-from ConfigParser import SafeConfigParser
+from configparser import SafeConfigParser
from optparse import OptionParser
from marvin.configGenerator import *
def getGlobalSettings(config):
- for k, v in dict(config.items('globals')).iteritems():
+ for k, v in dict(config.items('globals')).items():
cfg = configuration()
cfg.name = k
cfg.value = v
diff --git a/tools/marvin/marvin/sandbox/basic/basic_env.py b/tools/marvin/marvin/sandbox/basic/basic_env.py
index 6198163a866a..32b7dd58e138 100644
--- a/tools/marvin/marvin/sandbox/basic/basic_env.py
+++ b/tools/marvin/marvin/sandbox/basic/basic_env.py
@@ -25,13 +25,13 @@
'''
import random
import marvin
-from ConfigParser import SafeConfigParser
+from configparser import SafeConfigParser
from optparse import OptionParser
from marvin.configGenerator import *
def getGlobalSettings(config):
- for k, v in dict(config.items('globals')).iteritems():
+ for k, v in dict(config.items('globals')).items():
cfg = configuration()
cfg.name = k
cfg.value = v
diff --git a/tools/marvin/marvin/sandbox/demo/simulator/simulator_setup.py b/tools/marvin/marvin/sandbox/demo/simulator/simulator_setup.py
index 08b20cce67be..68fd828a47ad 100644
--- a/tools/marvin/marvin/sandbox/demo/simulator/simulator_setup.py
+++ b/tools/marvin/marvin/sandbox/demo/simulator/simulator_setup.py
@@ -18,14 +18,14 @@
import marvin
-from ConfigParser import SafeConfigParser
+from configparser import SafeConfigParser
from optparse import OptionParser
from marvin.configGenerator import *
import random
def getGlobalSettings(config):
- for k, v in dict(config.items('globals')).iteritems():
+ for k, v in dict(config.items('globals')).items():
cfg = configuration()
cfg.name = k
cfg.value = v
diff --git a/tools/marvin/marvin/sandbox/demo/simulator/testcase/libs/base.py b/tools/marvin/marvin/sandbox/demo/simulator/testcase/libs/base.py
index 7c8546c092c6..f3c9c241f02e 100644
--- a/tools/marvin/marvin/sandbox/demo/simulator/testcase/libs/base.py
+++ b/tools/marvin/marvin/sandbox/demo/simulator/testcase/libs/base.py
@@ -20,7 +20,7 @@
-Virtual machine, Volume, Snapshot etc
"""
-from utils import is_server_ssh_ready, random_gen
+from .utils import is_server_ssh_ready, random_gen
from marvin.cloudstackAPI import *
#Import System modules
import time
@@ -70,7 +70,7 @@ def delete(self, apiclient, cleanup=None):
def list(cls, apiclient, **kwargs):
"""Lists domains"""
cmd = listDomains.listDomainsCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
return(apiclient.listDomains(cmd))
@@ -115,7 +115,7 @@ def list(cls, apiclient, **kwargs):
listed accounts"""
cmd = listAccounts.listAccountsCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
return(apiclient.listAccounts(cmd))
@@ -156,7 +156,7 @@ def list(cls, apiclient, **kwargs):
listed users"""
cmd = listUsers.listUsersCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
return(apiclient.listUsers(cmd))
@@ -282,7 +282,7 @@ def list(cls, apiclient, **kwargs):
"""List all VMs matching criteria"""
cmd = listVirtualMachines.listVirtualMachinesCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
return(apiclient.listVirtualMachines(cmd))
@@ -372,7 +372,7 @@ def list(cls, apiclient, **kwargs):
"""List all volumes matching criteria"""
cmd = listVolumes.listVolumesCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
return(apiclient.listVolumes(cmd))
@@ -404,7 +404,7 @@ def list(cls, apiclient, **kwargs):
"""List all snapshots matching criteria"""
cmd = listSnapshots.listSnapshotsCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
return(apiclient.listSnapshots(cmd))
@@ -536,7 +536,7 @@ def list(cls, apiclient, **kwargs):
"""List all templates matching criteria"""
cmd = listTemplates.listTemplatesCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
return(apiclient.listTemplates(cmd))
@@ -618,7 +618,7 @@ def list(cls, apiclient, **kwargs):
"""Lists all available ISO files."""
cmd = listIsos.listIsosCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
return(apiclient.listIsos(cmd))
@@ -654,7 +654,7 @@ def list(cls, apiclient, **kwargs):
"""List all Public IPs matching criteria"""
cmd = listPublicIpAddresses.listPublicIpAddressesCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
return(apiclient.listPublicIpAddresses(cmd))
class NATRule:
@@ -692,7 +692,7 @@ def list(cls, apiclient, **kwargs):
"""List all NAT rules matching criteria"""
cmd = listPortForwardingRules.listPortForwardingRulesCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
return(apiclient.listPortForwardingRules(cmd))
@@ -735,7 +735,7 @@ def list(cls, apiclient, **kwargs):
"""List all IP forwarding rules matching criteria"""
cmd = listIpForwardingRules.listIpForwardingRulesCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
return(apiclient.listIpForwardingRules(cmd))
@classmethod
@@ -792,7 +792,7 @@ def list(cls, apiclient, **kwargs):
"""List all Firewall Rules matching criteria"""
cmd = listFirewallRules.listFirewallRulesCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
return(apiclient.listFirewallRules(cmd))
@@ -830,7 +830,7 @@ def list(cls, apiclient, **kwargs):
"""Lists all available service offerings."""
cmd = listServiceOfferings.listServiceOfferingsCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
return(apiclient.listServiceOfferings(cmd))
class DiskOffering:
@@ -863,7 +863,7 @@ def list(cls, apiclient, **kwargs):
"""Lists all available disk offerings."""
cmd = listDiskOfferings.listDiskOfferingsCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
return(apiclient.listDiskOfferings(cmd))
@@ -896,7 +896,7 @@ def list(cls, apiclient, **kwargs):
"""Lists snapshot policies."""
cmd = listSnapshotPolicies.listSnapshotPoliciesCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
return(apiclient.listSnapshotPolicies(cmd))
@@ -947,7 +947,7 @@ def list(cls, apiclient, **kwargs):
"""List all Load balancing rules matching criteria"""
cmd = listLoadBalancerRules.listLoadBalancerRulesCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
return(apiclient.listLoadBalancerRules(cmd))
@@ -997,7 +997,7 @@ def list(cls, apiclient, **kwargs):
"""List all Clusters matching criteria"""
cmd = listClusters.listClustersCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
return(apiclient.listClusters(cmd))
@@ -1064,7 +1064,7 @@ def list(cls, apiclient, **kwargs):
"""List all Hosts matching criteria"""
cmd = listHosts.listHostsCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
return(apiclient.listHosts(cmd))
@@ -1124,7 +1124,7 @@ def list(cls, apiclient, **kwargs):
"""List all storage pools matching criteria"""
cmd = listStoragePools.listStoragePoolsCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
return(apiclient.listStoragePools(cmd))
@@ -1161,7 +1161,7 @@ def list(cls, apiclient, **kwargs):
"""List all Networks matching criteria"""
cmd = listNetworks.listNetworksCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
return(apiclient.listNetworks(cmd))
@@ -1257,7 +1257,7 @@ def update(self, apiclient, **kwargs):
cmd = updateZone.updateZoneCmd()
cmd.id = self.id
- [setattr(cmd, k, v) for k, v in kwargs.items()]
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
return apiclient.updateZone(cmd)
@@ -1266,7 +1266,7 @@ def list(cls, apiclient, **kwargs):
"""List all Zones matching criteria"""
cmd = listZones.listZonesCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
return(apiclient.listZones(cmd))
@@ -1301,7 +1301,7 @@ def list(cls, apiclient, **kwargs):
"Returns a default pod for specified zone"
cmd = listPods.listPodsCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
return apiclient.listPods(cmd)
@@ -1339,7 +1339,7 @@ def list(cls, apiclient, **kwargs):
"""Lists all VLAN IP ranges."""
cmd = listVlanIpRanges.listVlanIpRangesCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
return(apiclient.listVlanIpRanges(cmd))
@@ -1432,5 +1432,5 @@ def list(cls, apiclient, **kwargs):
"""Lists all security groups."""
cmd = listSecurityGroups.listSecurityGroupsCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
return(apiclient.listSecurityGroups(cmd))
diff --git a/tools/marvin/marvin/sandbox/demo/simulator/testcase/libs/common.py b/tools/marvin/marvin/sandbox/demo/simulator/testcase/libs/common.py
index e0c452741b1f..861fd719e2ae 100644
--- a/tools/marvin/marvin/sandbox/demo/simulator/testcase/libs/common.py
+++ b/tools/marvin/marvin/sandbox/demo/simulator/testcase/libs/common.py
@@ -23,8 +23,8 @@
from marvin.cloudstackTestCase import *
from marvin.cloudstackAPI import *
import marvin.sshClient
-from utils import *
-from base import *
+from .utils import *
+from .base import *
#Import System modules
import time
@@ -258,133 +258,133 @@ def list_routers(apiclient, **kwargs):
"""List all Routers matching criteria"""
cmd = listRouters.listRoutersCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
return(apiclient.listRouters(cmd))
def list_zones(apiclient, **kwargs):
"""List all Zones matching criteria"""
cmd = listZones.listZonesCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
return(apiclient.listZones(cmd))
def list_networks(apiclient, **kwargs):
"""List all Networks matching criteria"""
cmd = listNetworks.listNetworksCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
return(apiclient.listNetworks(cmd))
def list_clusters(apiclient, **kwargs):
"""List all Clusters matching criteria"""
cmd = listClusters.listClustersCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
return(apiclient.listClusters(cmd))
def list_ssvms(apiclient, **kwargs):
"""List all SSVMs matching criteria"""
cmd = listSystemVms.listSystemVmsCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
return(apiclient.listSystemVms(cmd))
def list_storage_pools(apiclient, **kwargs):
"""List all storage pools matching criteria"""
cmd = listStoragePools.listStoragePoolsCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
return(apiclient.listStoragePools(cmd))
def list_virtual_machines(apiclient, **kwargs):
"""List all VMs matching criteria"""
cmd = listVirtualMachines.listVirtualMachinesCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
return(apiclient.listVirtualMachines(cmd))
def list_hosts(apiclient, **kwargs):
"""List all Hosts matching criteria"""
cmd = listHosts.listHostsCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
return(apiclient.listHosts(cmd))
def list_configurations(apiclient, **kwargs):
"""List configuration with specified name"""
cmd = listConfigurations.listConfigurationsCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
return(apiclient.listConfigurations(cmd))
def list_publicIP(apiclient, **kwargs):
"""List all Public IPs matching criteria"""
cmd = listPublicIpAddresses.listPublicIpAddressesCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
return(apiclient.listPublicIpAddresses(cmd))
def list_nat_rules(apiclient, **kwargs):
"""List all NAT rules matching criteria"""
cmd = listPortForwardingRules.listPortForwardingRulesCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
return(apiclient.listPortForwardingRules(cmd))
def list_lb_rules(apiclient, **kwargs):
"""List all Load balancing rules matching criteria"""
cmd = listLoadBalancerRules.listLoadBalancerRulesCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
return(apiclient.listLoadBalancerRules(cmd))
def list_lb_instances(apiclient, **kwargs):
"""List all Load balancing instances matching criteria"""
cmd = listLoadBalancerRuleInstances.listLoadBalancerRuleInstancesCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
return(apiclient.listLoadBalancerRuleInstances(cmd))
def list_firewall_rules(apiclient, **kwargs):
"""List all Firewall Rules matching criteria"""
cmd = listFirewallRules.listFirewallRulesCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
return(apiclient.listFirewallRules(cmd))
def list_volumes(apiclient, **kwargs):
"""List all volumes matching criteria"""
cmd = listVolumes.listVolumesCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
return(apiclient.listVolumes(cmd))
def list_isos(apiclient, **kwargs):
"""Lists all available ISO files."""
cmd = listIsos.listIsosCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
return(apiclient.listIsos(cmd))
def list_snapshots(apiclient, **kwargs):
"""List all snapshots matching criteria"""
cmd = listSnapshots.listSnapshotsCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
return(apiclient.listSnapshots(cmd))
def list_templates(apiclient, **kwargs):
"""List all templates matching criteria"""
cmd = listTemplates.listTemplatesCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
return(apiclient.listTemplates(cmd))
def list_domains(apiclient, **kwargs):
"""Lists domains"""
cmd = listDomains.listDomainsCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
return(apiclient.listDomains(cmd))
def list_accounts(apiclient, **kwargs):
@@ -392,7 +392,7 @@ def list_accounts(apiclient, **kwargs):
listed accounts"""
cmd = listAccounts.listAccountsCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
return(apiclient.listAccounts(cmd))
def list_users(apiclient, **kwargs):
@@ -400,61 +400,61 @@ def list_users(apiclient, **kwargs):
listed users"""
cmd = listUsers.listUsersCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
return(apiclient.listUsers(cmd))
def list_snapshot_policy(apiclient, **kwargs):
"""Lists snapshot policies."""
cmd = listSnapshotPolicies.listSnapshotPoliciesCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
return(apiclient.listSnapshotPolicies(cmd))
def list_events(apiclient, **kwargs):
"""Lists events"""
cmd = listEvents.listEventsCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
return(apiclient.listEvents(cmd))
def list_disk_offering(apiclient, **kwargs):
"""Lists all available disk offerings."""
cmd = listDiskOfferings.listDiskOfferingsCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
return(apiclient.listDiskOfferings(cmd))
def list_service_offering(apiclient, **kwargs):
"""Lists all available service offerings."""
cmd = listServiceOfferings.listServiceOfferingsCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
return(apiclient.listServiceOfferings(cmd))
def list_vlan_ipranges(apiclient, **kwargs):
"""Lists all VLAN IP ranges."""
cmd = listVlanIpRanges.listVlanIpRangesCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
return(apiclient.listVlanIpRanges(cmd))
def list_usage_records(apiclient, **kwargs):
"""Lists usage records for accounts"""
cmd = listUsageRecords.listUsageRecordsCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
return(apiclient.listUsageRecords(cmd))
def list_network_offerings(apiclient, **kwargs):
"""Lists network offerings"""
cmd = listNetworkOfferings.listNetworkOfferingsCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
return(apiclient.listNetworkOfferings(cmd))
def list_resource_limits(apiclient, **kwargs):
"""Lists resource limits"""
cmd = listResourceLimits.listResourceLimitsCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
return(apiclient.listResourceLimits(cmd))
diff --git a/tools/marvin/marvin/sshClient.py b/tools/marvin/marvin/sshClient.py
index e872256812c8..8b8405cc8c82 100644
--- a/tools/marvin/marvin/sshClient.py
+++ b/tools/marvin/marvin/sshClient.py
@@ -211,4 +211,4 @@ def close(self):
with contextlib.closing(SshClient("127.0.0.1", 22, "root",
"asdf!@34")) as ssh:
ret = ssh.runCommand("ls -l")
- print ret
+ print(ret)
diff --git a/tools/marvin/marvin/tcExecuteEngine.py b/tools/marvin/marvin/tcExecuteEngine.py
index 11b5d093d314..22c06c2a680d 100644
--- a/tools/marvin/marvin/tcExecuteEngine.py
+++ b/tools/marvin/marvin/tcExecuteEngine.py
@@ -70,7 +70,7 @@ def injectTestCase(self, test_suites):
def run(self):
if self.__suite:
- print "\n==== Test Suite :%s Started ====" % (str(self.__suite))
+ print("\n==== Test Suite :%s Started ====" % (str(self.__suite)))
unittest.TextTestRunner(stream=self.__debugStream,
verbosity=2).run(self.__suite)
- print "\n==== Test Suite :%s Finished ====" % (str(self.__suite))
+ print("\n==== Test Suite :%s Finished ====" % (str(self.__suite)))
diff --git a/tools/marvin/mvn-setup.py b/tools/marvin/mvn-setup.py
index 5aa251b9077f..a6b17e56ed07 100755
--- a/tools/marvin/mvn-setup.py
+++ b/tools/marvin/mvn-setup.py
@@ -42,7 +42,7 @@ def replaceVersion(fname, version):
def runSetupScript(args):
"""Invoke setup.py with the provided arguments"""
- cmd = ['python', setupScript] + args
+ cmd = ['python3', setupScript] + args
exitCode = subprocess.call(cmd)
return exitCode
diff --git a/tools/marvin/pom.xml b/tools/marvin/pom.xml
index 5e2e53c87b3b..b484c25351a3 100644
--- a/tools/marvin/pom.xml
+++ b/tools/marvin/pom.xml
@@ -69,7 +69,7 @@
${basedir}/marvin
- python
+ python3
codegenerator.py
-s
diff --git a/tools/marvin/setup.py b/tools/marvin/setup.py
index 666c4a275e3f..12ff27137b5f 100644
--- a/tools/marvin/setup.py
+++ b/tools/marvin/setup.py
@@ -49,7 +49,7 @@
"mysql-connector-python >= 1.1.6",
"requests >= 2.2.1",
"paramiko >= 1.13.0",
- "nose >= 1.3.3",
+ "nose2 >= 0.9.2",
"ddt >= 0.4.0",
"pyvmomi >= 5.5.0",
"netaddr >= 0.7.14",