You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by gi...@apache.org on 2014/06/16 13:25:57 UTC
[1/3] CLOUDSTACK-6282: Modified IPAddress tests to fix the failures.
Modified Instances, snapshots, templates tests to handle KVM Hypervisor
Repository: cloudstack
Updated Branches:
refs/heads/4.4-forward 497042508 -> 89c35abb4
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/89c35abb/test/integration/component/test_escalations_snapshots.py
----------------------------------------------------------------------
diff --git a/test/integration/component/test_escalations_snapshots.py b/test/integration/component/test_escalations_snapshots.py
index 2367253..0aa36c3 100644
--- a/test/integration/component/test_escalations_snapshots.py
+++ b/test/integration/component/test_escalations_snapshots.py
@@ -15,42 +15,19 @@
# specific language governing permissions and limitations
# under the License.
-#Import Local Modules
-from marvin.cloudstackTestCase import cloudstackTestCase
-from marvin.cloudstackAPI import (createVolume,
- createTemplate)
-from marvin.lib.base import (Volume,
- Iso,
- VirtualMachine,
- Template,
- Snapshot,
- SecurityGroup,
- Account,
- Zone,
- Network,
- NetworkOffering,
- DiskOffering,
- ServiceOffering,
- VmSnapshot,
- SnapshotPolicy,
- SSHKeyPair,
- Resources,
- Configurations,
- VpnCustomerGateway,
- Hypervisor,
- VpcOffering,
- VPC,
- NetworkACL)
-from marvin.lib.common import (get_zone,
- get_domain,
- get_template,
- list_os_types)
-from marvin.lib.utils import (validateList,
- cleanup_resources,
- random_gen)
-from marvin.codes import (PASS, FAIL, EMPTY_LIST)
+# Import Local Modules
+from marvin.cloudstackTestCase import *
+from marvin.cloudstackException import *
+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 marvin.lib.utils import checkVolumeSize
+from marvin.codes import SUCCESS
from nose.plugins.attrib import attr
-import time
+from time import sleep
+from ctypes.wintypes import BOOLEAN
class TestSnapshots(cloudstackTestCase):
@@ -61,6 +38,7 @@ class TestSnapshots(cloudstackTestCase):
cls.testClient = super(TestSnapshots, cls).getClsTestClient()
cls.api_client = cls.testClient.getApiClient()
cls.services = cls.testClient.getParsedTestDataConfig()
+ cls.hypervisor = cls.testClient.getHypervisorInfo()
# Get Domain, Zone, Template
cls.domain = get_domain(cls.api_client)
cls.zone = get_zone(cls.api_client, cls.testClient.getZoneForTests())
@@ -123,7 +101,7 @@ class TestSnapshots(cloudstackTestCase):
self.cleanup = []
def tearDown(self):
- #Clean up, terminate the created resources
+ # Clean up, terminate the created resources
cleanup_resources(self.apiClient, self.cleanup)
return
@@ -387,7 +365,7 @@ class TestSnapshots(cloudstackTestCase):
"Size of the list volume snapshot by Id is not matching"
)
# Verifying details of the listed snapshot to be same as snapshot created above
- #Creating expected and actual values dictionaries
+ # Creating expected and actual values dictionaries
expected_dict = {
"id":snapshot_created.id,
"name":snapshot_created.name,
@@ -435,6 +413,8 @@ class TestSnapshots(cloudstackTestCase):
Step11: Listing all the volume snapshots in page2
Step12: Verifying that list size is 0
"""
+ if self.hypervisor.lower() == 'kvm':
+ raise unittest.SkipTest("VM Snapshot is not supported on KVM. Hence, skipping the test")
# Listing all the VM snapshots for a User
list_vm_snaps_before = VmSnapshot.list(
self.userapiclient,
@@ -529,7 +509,7 @@ class TestSnapshots(cloudstackTestCase):
"VM snapshot not deleted from page 2"
)
# Deleting all the existing VM snapshots
- list_vm_snaps = VmSnapshot.list(
+ list_vm_snaps = VmSnapshot.list(
self.userapiclient,
listall=self.services["listall"],
)
@@ -567,6 +547,8 @@ class TestSnapshots(cloudstackTestCase):
Step7: Verifying that list size is 1
Step8: Verifying details of the listed VM snapshot
"""
+ if self.hypervisor.lower() == 'kvm':
+ raise unittest.SkipTest("VM Snapshot is not supported on KVM. Hence, skipping the test")
# Listing all the VM snapshots for a User
list_vm_snaps_before = VmSnapshot.list(
self.userapiclient,
@@ -622,7 +604,7 @@ class TestSnapshots(cloudstackTestCase):
"Size of the list vm snapshot by Id is not matching"
)
# Verifying details of the listed snapshot to be same as snapshot created above
- #Creating expected and actual values dictionaries
+ # Creating expected and actual values dictionaries
expected_dict = {
"id":snapshot_created.id,
"name":snapshot_created.name,
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/89c35abb/test/integration/component/test_escalations_templates.py
----------------------------------------------------------------------
diff --git a/test/integration/component/test_escalations_templates.py b/test/integration/component/test_escalations_templates.py
index 083ba90..06e3d42 100644
--- a/test/integration/component/test_escalations_templates.py
+++ b/test/integration/component/test_escalations_templates.py
@@ -15,42 +15,19 @@
# specific language governing permissions and limitations
# under the License.
-#Import Local Modules
-from marvin.cloudstackTestCase import cloudstackTestCase
-from marvin.cloudstackAPI import (createVolume,
- createTemplate)
-from marvin.lib.base import (Volume,
- Iso,
- VirtualMachine,
- Template,
- Snapshot,
- SecurityGroup,
- Account,
- Zone,
- Network,
- NetworkOffering,
- DiskOffering,
- ServiceOffering,
- VmSnapshot,
- SnapshotPolicy,
- SSHKeyPair,
- Resources,
- Configurations,
- VpnCustomerGateway,
- Hypervisor,
- VpcOffering,
- VPC,
- NetworkACL)
-from marvin.lib.common import (get_zone,
- get_domain,
- get_template,
- list_os_types)
-from marvin.lib.utils import (validateList,
- cleanup_resources,
- random_gen)
-from marvin.codes import (PASS, FAIL, EMPTY_LIST)
+# Import Local Modules
+from marvin.cloudstackTestCase import *
+from marvin.cloudstackException import *
+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 marvin.lib.utils import checkVolumeSize
+from marvin.codes import SUCCESS
from nose.plugins.attrib import attr
-import time
+from time import sleep
+from ctypes.wintypes import BOOLEAN
class TestTemplates(cloudstackTestCase):
@@ -91,7 +68,7 @@ class TestTemplates(cloudstackTestCase):
self.cleanup = []
def tearDown(self):
- #Clean up, terminate the created resources
+ # Clean up, terminate the created resources
cleanup_resources(self.apiClient, self.cleanup)
return
@@ -168,14 +145,12 @@ class TestTemplates(cloudstackTestCase):
list_templates_before,
"Templates listed for newly created User"
)
- self.services["template"]["url"] = "http://10.147.28.7/templates/ttylinux_pv.vhd"
- self.services["template"]["format"] = "VHD"
- self.services["template"]["ostype"] = self.services["ostype"]
+ self.services["templateregister"]["ostype"] = self.services["ostype"]
# Creating pagesize + 1 number of Templates
for i in range(0, (self.services["pagesize"] + 1)):
template_created = Template.register(
self.userapiclient,
- self.services["template"],
+ self.services["templateregister"],
self.zone.id,
hypervisor=self.hypervisor
)
@@ -290,9 +265,7 @@ class TestTemplates(cloudstackTestCase):
list_templates_page2,
"Templates not deleted from page 2"
)
- del self.services["template"]["url"]
- del self.services["template"]["format"]
- del self.services["template"]["ostype"]
+ del self.services["templateregister"]["ostype"]
return
@attr(tags=["advanced", "basic", "provisioning"])
@@ -322,14 +295,12 @@ class TestTemplates(cloudstackTestCase):
list_templates_before,
"Templates listed for newly created User"
)
- self.services["template"]["url"] = "http://10.147.28.7/templates/ttylinux_pv.vhd"
- self.services["template"]["format"] = "VHD"
- self.services["template"]["ostype"] = self.services["ostype"]
- self.services["template"]["isextractable"] = True
+ self.services["templateregister"]["ostype"] = self.services["ostype"]
+ self.services["templateregister"]["isextractable"] = True
# Creating aTemplate
template_created = Template.register(
self.userapiclient,
- self.services["template"],
+ self.services["templateregister"],
self.zone.id,
hypervisor=self.hypervisor
)
@@ -410,10 +381,8 @@ class TestTemplates(cloudstackTestCase):
download_template.id,
"Download Template details are not same as Template created"
)
- del self.services["template"]["url"]
- del self.services["template"]["format"]
- del self.services["template"]["ostype"]
- del self.services["template"]["isextractable"]
+ del self.services["templateregister"]["ostype"]
+ del self.services["templateregister"]["isextractable"]
return
@attr(tags=["advanced", "basic", "provisioning"])
@@ -451,13 +420,11 @@ class TestTemplates(cloudstackTestCase):
list_templates_before,
"Templates listed for newly created User"
)
- self.services["template"]["url"] = "http://10.147.28.7/templates/ttylinux_pv.vhd"
- self.services["template"]["format"] = "VHD"
- self.services["template"]["ostype"] = self.services["ostype"]
+ self.services["templateregister"]["ostype"] = self.services["ostype"]
# Creating aTemplate
template_created = Template.register(
self.userapiclient,
- self.services["template"],
+ self.services["templateregister"],
self.zone.id,
hypervisor=self.hypervisor
)
@@ -727,9 +694,7 @@ class TestTemplates(cloudstackTestCase):
edit_template_status,
"Edited Template details are not as expected"
)
- del self.services["template"]["url"]
- del self.services["template"]["format"]
- del self.services["template"]["ostype"]
+ del self.services["templateregister"]["ostype"]
return
@attr(tags=["advanced", "basic", "provisioning"])
@@ -768,7 +733,7 @@ class TestTemplates(cloudstackTestCase):
"Failed to list Zones"
)
if not len(zones_list) > 1:
- self.fail("Enough zones doesnot exists to copy template")
+ raise unittest.SkipTest("Enough zones doesnot exists to copy template")
else:
# Listing all the Templates for a User in Zone 1
list_templates_zone1 = Template.list(
@@ -794,10 +759,8 @@ class TestTemplates(cloudstackTestCase):
list_templates_zone2,
"Templates listed for newly created User in Zone2"
)
- self.services["template"]["url"] = "http://10.147.28.7/templates/ttylinux_pv.vhd"
- self.services["template"]["format"] = "VHD"
- self.services["template"]["ostype"] = self.services["ostype"]
- #Listing Hypervisors in Zone 1
+ self.services["templateregister"]["ostype"] = self.services["ostype"]
+ # Listing Hypervisors in Zone 1
hypervisor_list = Hypervisor.list(
self.apiClient,
zoneid=zones_list[0].id
@@ -811,7 +774,7 @@ class TestTemplates(cloudstackTestCase):
# Creating aTemplate in Zone 1
template_created = Template.register(
self.userapiclient,
- self.services["template"],
+ self.services["templateregister"],
zones_list[0].id,
hypervisor=hypervisor_list[0].name
)
@@ -938,7 +901,5 @@ class TestTemplates(cloudstackTestCase):
list_templates_zone2[0].isready,
"Failed to copy Template"
)
- del self.services["template"]["url"]
- del self.services["template"]["format"]
- del self.services["template"]["ostype"]
+ del self.services["templateregister"]["ostype"]
return
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/89c35abb/tools/marvin/marvin/config/test_data.py
----------------------------------------------------------------------
diff --git a/tools/marvin/marvin/config/test_data.py b/tools/marvin/marvin/config/test_data.py
index 44ef8d5..801c549 100644
--- a/tools/marvin/marvin/config/test_data.py
+++ b/tools/marvin/marvin/config/test_data.py
@@ -741,6 +741,13 @@ test_data = {
"ostype": "CentOS 5.3 (64-bit)",
"templatefilter": 'self',
},
+ "templateregister": {
+ "displaytext": "xs",
+ "name": "xs",
+ "passwordenabled": False,
+ "url": "http://10.147.28.7/templates/ttylinux_pv.vhd",
+ "format": "VHD"
+ },
"security_group": {"name": "custom_Sec_Grp"},
"ingress_rule": {
"protocol": "TCP",
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/89c35abb/tools/marvin/marvin/lib/base.py
----------------------------------------------------------------------
diff --git a/tools/marvin/marvin/lib/base.py b/tools/marvin/marvin/lib/base.py
index 2681724..8b89087 100644
--- a/tools/marvin/marvin/lib/base.py
+++ b/tools/marvin/marvin/lib/base.py
@@ -1562,7 +1562,7 @@ class StaticNATRule:
return
@classmethod
- def disable(cls, apiclient, ipaddressid, virtualmachineid):
+ def disable(cls, apiclient, ipaddressid, virtualmachineid=None):
"""Disables Static NAT rule"""
cmd = disableStaticNat.disableStaticNatCmd()
[2/3] CLOUDSTACK-6282: Modified IPAddress tests to fix the failures.
Modified Instances, snapshots, templates tests to handle KVM Hypervisor
Posted by gi...@apache.org.
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/89c35abb/test/integration/component/test_escalations_ipaddresses.py
----------------------------------------------------------------------
diff --git a/test/integration/component/test_escalations_ipaddresses.py b/test/integration/component/test_escalations_ipaddresses.py
index 23dd76b..0b31d2e 100644
--- a/test/integration/component/test_escalations_ipaddresses.py
+++ b/test/integration/component/test_escalations_ipaddresses.py
@@ -15,7 +15,7 @@
# specific language governing permissions and limitations
# under the License.
-#Import Local Modules
+# Import Local Modules
from marvin.cloudstackTestCase import *
from marvin.cloudstackException import *
from marvin.cloudstackAPI import *
@@ -27,6 +27,7 @@ from marvin.lib.utils import checkVolumeSize
from marvin.codes import SUCCESS
from nose.plugins.attrib import attr
from time import sleep
+from ctypes.wintypes import BOOLEAN
class TestIpAddresses(cloudstackTestCase):
@@ -37,6 +38,7 @@ class TestIpAddresses(cloudstackTestCase):
cls.testClient = super(TestIpAddresses, cls).getClsTestClient()
cls.api_client = cls.testClient.getApiClient()
cls.services = cls.testClient.getParsedTestDataConfig()
+ cls.hypervisor = cls.testClient.getHypervisorInfo()
# Get Domain, Zone, Template
cls.domain = get_domain(cls.api_client)
cls.zone = get_zone(cls.api_client, cls.testClient.getZoneForTests())
@@ -51,7 +53,7 @@ class TestIpAddresses(cloudstackTestCase):
else:
cls.storagetype = 'shared'
cls.services["service_offerings"]["tiny"]["storagetype"] = 'shared'
-
+
cls.services['mode'] = cls.zone.networktype
cls.services["virtual_machine"]["hypervisor"] = cls.testClient.getHypervisorInfo()
cls.services["virtual_machine"]["zoneid"] = cls.zone.id
@@ -62,15 +64,7 @@ class TestIpAddresses(cloudstackTestCase):
)
cls._cleanup.append(cls.service_offering)
cls.services['mode'] = cls.zone.networktype
- cls.account = Account.create(
- cls.api_client,
- cls.services["account"],
- domainid=cls.domain.id
- )
- # Getting authentication for user in newly created Account
- cls.user = cls.account.user[0]
- cls.userapiclient = cls.testClient.getUserApiClient(cls.user.username, cls.domain.name)
- cls._cleanup.append(cls.account)
+
except Exception as e:
cls.tearDownClass()
raise Exception("Warning: Exception in setup : %s" % e)
@@ -80,9 +74,18 @@ class TestIpAddresses(cloudstackTestCase):
self.apiClient = self.testClient.getApiClient()
self.cleanup = []
+ self.account = Account.create(
+ self.apiClient,
+ self.services["account"],
+ domainid=self.domain.id
+ )
+ # Getting authentication for user in newly created Account
+ self.user = self.account.user[0]
+ self.userapiclient = self.testClient.getUserApiClient(self.user.username, self.domain.name)
+# self.cleanup.append(self.account)
def tearDown(self):
- #Clean up, terminate the created volumes
+ # Clean up, terminate the created volumes
cleanup_resources(self.apiClient, self.cleanup)
return
@@ -125,7 +128,7 @@ class TestIpAddresses(cloudstackTestCase):
@attr(tags=["advanced", "provisioning"])
def test_01_list_ipaddresses_pagination(self):
- """
+ """
@summary: Test List IP Addresses pagination
@Steps:
Step1: Creating a network for the user
@@ -209,7 +212,7 @@ class TestIpAddresses(cloudstackTestCase):
list_ipaddresses_before,
"IP Addresses listed for newly created user"
)
- # Associating (pagesize + 1) number of IP Addresses
+ # Associating (pagesize + 1) number of IP Addresses
for i in range(0, (self.services["pagesize"] + 1)):
ipaddress = PublicIPAddress.create(
self.userapiclient,
@@ -220,7 +223,7 @@ class TestIpAddresses(cloudstackTestCase):
ipaddress,
"Failed to Associate IP Address"
)
-
+
# Listing all the IP Addresses for a user
list_ipaddresses_after = PublicIPAddress.list(
self.userapiclient,
@@ -290,11 +293,12 @@ class TestIpAddresses(cloudstackTestCase):
list_ipaddress_page2,
"Disassociation of IP Address Failed"
)
+ self.cleanup.append(self.account)
return
-
+
@attr(tags=["advanced", "provisioning"])
def test_02_list_ipaddresses_byid(self):
- """
+ """
@summary: Test List IP Addresses details by ID
@Steps:
Step1: Creating a network for the user
@@ -391,7 +395,7 @@ class TestIpAddresses(cloudstackTestCase):
list_ipaddresses_before,
"IP Addresses listed for newly created user"
)
- # Associating an IP Addresses to Network created
+ # Associating an IP Addresses to Network created
associated_ipaddress = PublicIPAddress.create(
self.userapiclient,
services=self.services["network"],
@@ -464,11 +468,12 @@ class TestIpAddresses(cloudstackTestCase):
ipaddress_status,
"Listed IP Address details are not as expected"
)
+ self.cleanup.append(self.account)
return
-
+
@attr(tags=["advanced", "provisioning"])
def test_03_associate_ipaddress_for_vpc(self):
- """
+ """
@summary: Test to Associate IP Address for VPC
@Steps:
Step1: Creating a VPC for the user
@@ -507,12 +512,12 @@ class TestIpAddresses(cloudstackTestCase):
"VPC Creation Failed"
)
self.cleanup.append(vpc_created)
- # Listing the vpc for a user after creating a vpc
+ # Listing the vpc for a user after creating a vpc
list_vpc_after = VPC.list(self.userapiclient)
status = validateList(list_vpc_after)
self.assertEquals(
- PASS,
- status[0],
+ PASS,
+ status[0],
"list VPC not as expected"
)
# Verifying the list vpc size is increased by 1
@@ -537,7 +542,7 @@ class TestIpAddresses(cloudstackTestCase):
len(list_ipaddresses_before),
"Failed to List VPC IP Address"
)
- # Associating an IP Addresses to VPC created
+ # Associating an IP Addresses to VPC created
associated_ipaddress = PublicIPAddress.create(
self.userapiclient,
services=self.services["network"],
@@ -615,11 +620,12 @@ class TestIpAddresses(cloudstackTestCase):
ipaddress_status,
"Listed IP Address details are not as expected"
)
+ self.cleanup.append(self.account)
return
-
+
@attr(tags=["advanced", "provisioning"])
def test_04_create_delete_lbrule_fornonvpc(self):
- """
+ """
@summary: Test to list, create and delete Load Balancer Rule for IP Address associated to Non VPC network
@Steps:
Step1: Creating a Network for the user
@@ -682,7 +688,7 @@ class TestIpAddresses(cloudstackTestCase):
list_ipaddresses_before,
"IP Addresses listed for newly created User"
)
- # Associating an IP Addresses to Network created
+ # Associating an IP Addresses to Network created
associated_ipaddress = PublicIPAddress.create(
self.userapiclient,
services=self.services["network"],
@@ -785,11 +791,12 @@ class TestIpAddresses(cloudstackTestCase):
list_lbrules_after,
"Failed to delete Load Balancer Rule"
)
+ self.cleanup.append(self.account)
return
-
+
@attr(tags=["advanced", "provisioning"])
def test_05_create_delete_lbrule_forvpc(self):
- """
+ """
@summary: Test to list, create and delete Load Balancer Rule for IP Address associated to VPC
@Steps:
Step1: Creating a VPC for the user
@@ -829,12 +836,12 @@ class TestIpAddresses(cloudstackTestCase):
vpc_created,
"VPC Creation Failed"
)
- # Listing the vpc for a user after creating a vpc
+ # Listing the vpc for a user after creating a vpc
list_vpc_after = VPC.list(self.userapiclient)
status = validateList(list_vpc_after)
self.assertEquals(
- PASS,
- status[0],
+ PASS,
+ status[0],
"list VPC not as expected"
)
# Verifying the list vpc size is increased by 1
@@ -843,25 +850,25 @@ class TestIpAddresses(cloudstackTestCase):
len(list_vpc_after),
"list VPC not equal as expected"
)
- #List network offering for vpc = true
+ # List network offering for vpc = true
network_offering_vpc_true_list = NetworkOffering.list(
self.userapiclient,
- forvpc = "true",
- zoneid = self.zone.id,
- supportedServices = "Lb",
- state = "Enabled"
+ forvpc="true",
+ zoneid=self.zone.id,
+ supportedServices="Lb",
+ state="Enabled"
)
status = validateList(network_offering_vpc_true_list)
- self.assertEquals(PASS, status[0], "Default network offering not present for vpc = true with Lb")
- # Creating network under VPC
+ self.assertEquals(PASS, status[0], "Default network offering not present for vpc = true with Lb")
+ # Creating network under VPC
network_created = Network.create(
self.userapiclient,
self.services["ntwk"],
- networkofferingid = network_offering_vpc_true_list[0].id,
- vpcid = vpc_created.id,
+ networkofferingid=network_offering_vpc_true_list[0].id,
+ vpcid=vpc_created.id,
zoneid=self.zone.id,
- gateway= self.services["ntwk"]["gateway"],
- netmask = self.services["ntwk"]["netmask"]
+ gateway=self.services["ntwk"]["gateway"],
+ netmask=self.services["ntwk"]["netmask"]
)
self.cleanup.append(network_created)
self.assertIsNotNone(
@@ -876,8 +883,8 @@ class TestIpAddresses(cloudstackTestCase):
)
status = validateList(list_ipaddresses_before)
self.assertEquals(
- PASS,
- status[0],
+ PASS,
+ status[0],
"list IP Addresses not as expected"
)
# Verifying the list vpc size is increased by 1
@@ -886,7 +893,7 @@ class TestIpAddresses(cloudstackTestCase):
len(list_ipaddresses_before),
"list IP Addresses not equal as expected"
)
- # Associating an IP Addresses to VPC created
+ # Associating an IP Addresses to VPC created
associated_ipaddress = PublicIPAddress.create(
self.userapiclient,
services=self.services["network"],
@@ -990,11 +997,12 @@ class TestIpAddresses(cloudstackTestCase):
list_lbrules_after,
"Failed to delete Load Balancer Rule"
)
+ self.cleanup.append(self.account)
return
-
+
@attr(tags=["advanced", "provisioning"])
def test_06_update_lbrule_name(self):
- """
+ """
@summary: Test to Update Load Balancer Rule Name for IP Address associated to Non VPC network
@Steps:
Step1: Creating a Network for the user
@@ -1073,7 +1081,7 @@ class TestIpAddresses(cloudstackTestCase):
list_ipaddresses_before,
"IP Addresses listed for newly created User"
)
- # Associating an IP Addresses to Network created
+ # Associating an IP Addresses to Network created
associated_ipaddress = PublicIPAddress.create(
self.userapiclient,
services=self.services["network"],
@@ -1186,11 +1194,12 @@ class TestIpAddresses(cloudstackTestCase):
lbrule_status,
"Updated Load Balancer Rule details are not as expected"
)
+ self.cleanup.append(self.account)
return
-
+
@attr(tags=["advanced", "provisioning"])
def test_07_assign_remove_lbrule_toinstance(self):
- """
+ """
@summary: Test to Assign and Remove Load Balancer Rule to an Instance
@Steps:
Step1: Creating a Network for the user
@@ -1260,7 +1269,7 @@ class TestIpAddresses(cloudstackTestCase):
list_ipaddresses_before,
"IP Addresses listed for newly created User"
)
- # Associating an IP Addresses to Network created
+ # Associating an IP Addresses to Network created
associated_ipaddress = PublicIPAddress.create(
self.userapiclient,
services=self.services["network"],
@@ -1501,11 +1510,12 @@ class TestIpAddresses(cloudstackTestCase):
# Destroying the VM Launched
vm_created.delete(self.userapiclient)
vm_created.expung(self.apiClient)
+ self.cleanup.append(self.account)
return
-
+
@attr(tags=["advanced", "provisioning"])
def test_08_list_create_delete_lbsticky_policy(self):
- """
+ """
@summary: Test to List, Create, Delete Load Balancer Stickyness Policy
@Steps:
Step1: Creating a Network for the user
@@ -1586,7 +1596,7 @@ class TestIpAddresses(cloudstackTestCase):
list_ipaddresses_before,
"IP Addresses listed for newly created User"
)
- # Associating an IP Addresses to Network created
+ # Associating an IP Addresses to Network created
associated_ipaddress = PublicIPAddress.create(
self.userapiclient,
services=self.services["network"],
@@ -1700,7 +1710,7 @@ class TestIpAddresses(cloudstackTestCase):
True,
lbstickypolicy_status,
"Created Load Balancer Sticky Policy details are not as expected"
- )
+ )
# Listing Load Balancer Stickyness Policies for LB Rule
list_lbstickypolicy_after = LoadBalancerRule.listStickyPolicies(
self.userapiclient,
@@ -1737,11 +1747,12 @@ class TestIpAddresses(cloudstackTestCase):
len(list_lbstickypolicy_after[0].stickinesspolicy),
"Sticky Policy listed for newly created Load Balancer Rule"
)
+ self.cleanup.append(self.account)
return
-
+
@attr(tags=["advanced", "provisioning"])
def test_09_create_delete_portforwarding_fornonvpc(self):
- """
+ """
@summary: Test to list, create and delete Port Forwarding for IP Address associated to Non VPC network
@Steps:
Step1: Creating a Network for the user
@@ -1804,7 +1815,7 @@ class TestIpAddresses(cloudstackTestCase):
list_ipaddresses_before,
"IP Addresses listed for newly created User"
)
- # Associating an IP Addresses to Network created
+ # Associating an IP Addresses to Network created
associated_ipaddress = PublicIPAddress.create(
self.userapiclient,
services=self.services["network"],
@@ -1960,11 +1971,12 @@ class TestIpAddresses(cloudstackTestCase):
# Destroying the VM Launched
vm_created.delete(self.userapiclient)
vm_created.expung(self.apiClient)
+ self.cleanup.append(self.account)
return
-
+
@attr(tags=["advanced", "provisioning"])
def test_10_create_delete_portforwarding_forvpc(self):
- """
+ """
@summary: Test to list, create and delete Port Forwarding Rule for IP Address associated to VPC
@Steps:
Step1: Creating a VPC for the user
@@ -2006,12 +2018,12 @@ class TestIpAddresses(cloudstackTestCase):
vpc_created,
"VPC Creation Failed"
)
- # Listing the vpc for a user after creating a vpc
+ # Listing the vpc for a user after creating a vpc
list_vpc_after = VPC.list(self.userapiclient)
status = validateList(list_vpc_after)
self.assertEquals(
- PASS,
- status[0],
+ PASS,
+ status[0],
"list VPC not as expected"
)
# Verifying the list vpc size is increased by 1
@@ -2020,25 +2032,25 @@ class TestIpAddresses(cloudstackTestCase):
len(list_vpc_after),
"list VPC not equal as expected"
)
- #List network offering for vpc = true
+ # List network offering for vpc = true
network_offering_vpc_true_list = NetworkOffering.list(
self.userapiclient,
- forvpc = "true",
- zoneid = self.zone.id,
- supportedServices = "SourceNat,PortForwarding",
- state = "Enabled"
+ forvpc="true",
+ zoneid=self.zone.id,
+ supportedServices="SourceNat,PortForwarding",
+ state="Enabled"
)
status = validateList(network_offering_vpc_true_list)
- self.assertEquals(PASS, status[0], "Default network offering not present for vpc = true with PortForwarding")
- # Creating network under VPC
+ self.assertEquals(PASS, status[0], "Default network offering not present for vpc = true with PortForwarding")
+ # Creating network under VPC
network_created = Network.create(
self.userapiclient,
self.services["ntwk"],
- networkofferingid = network_offering_vpc_true_list[0].id,
- vpcid = vpc_created.id,
+ networkofferingid=network_offering_vpc_true_list[0].id,
+ vpcid=vpc_created.id,
zoneid=self.zone.id,
- gateway= self.services["ntwk"]["gateway"],
- netmask = self.services["ntwk"]["netmask"]
+ gateway=self.services["ntwk"]["gateway"],
+ netmask=self.services["ntwk"]["netmask"]
)
self.assertIsNotNone(
network_created,
@@ -2051,8 +2063,8 @@ class TestIpAddresses(cloudstackTestCase):
)
status = validateList(list_ipaddresses_before)
self.assertEquals(
- PASS,
- status[0],
+ PASS,
+ status[0],
"list IP Addresses not as expected"
)
# Verifying the list vpc size is increased by 1
@@ -2061,7 +2073,7 @@ class TestIpAddresses(cloudstackTestCase):
len(list_ipaddresses_before),
"list IP Addresses not equal as expected"
)
- # Associating an IP Addresses to VPC created
+ # Associating an IP Addresses to VPC created
associated_ipaddress = PublicIPAddress.create(
self.userapiclient,
services=self.services["network"],
@@ -2183,11 +2195,12 @@ class TestIpAddresses(cloudstackTestCase):
# Destroying the VM Launched
vm_created.delete(self.userapiclient)
vm_created.expung(self.apiClient)
+ self.cleanup.append(self.account)
return
-
+
@attr(tags=["advanced", "provisioning"])
def test_11_create_delete_firewallrule(self):
- """
+ """
@summary: Test to list, create and delete Firewall Rule for IP Address associated to Non VPC network
@Steps:
Step1: Creating a Network for the user
@@ -2250,7 +2263,7 @@ class TestIpAddresses(cloudstackTestCase):
list_ipaddresses_before,
"IP Addresses listed for newly created User"
)
- # Associating an IP Addresses to Network created
+ # Associating an IP Addresses to Network created
associated_ipaddress = PublicIPAddress.create(
self.userapiclient,
services=self.services["network"],
@@ -2357,11 +2370,12 @@ class TestIpAddresses(cloudstackTestCase):
list_firewalls_after,
"Failed to create Firewall Rule"
)
+ self.cleanup.append(self.account)
return
-
+
@attr(tags=["advanced", "provisioning"])
def test_12_create_delete_remoteaccessvpn(self):
- """
+ """
@summary: Test to list, create and delete Remote Access VPNs
@Steps:
Step1: Creating a Network for the user
@@ -2424,7 +2438,7 @@ class TestIpAddresses(cloudstackTestCase):
list_ipaddresses_before,
"IP Addresses listed for newly created User"
)
- # Associating an IP Addresses to Network created
+ # Associating an IP Addresses to Network created
associated_ipaddress = PublicIPAddress.create(
self.userapiclient,
services=self.services["network"],
@@ -2528,11 +2542,12 @@ class TestIpAddresses(cloudstackTestCase):
list_vpns_after,
"Failed to create Remote Access VPN"
)
+ self.cleanup.append(self.account)
return
-
+
@attr(tags=["advanced", "provisioning"])
def test_13_add_remove_vpnusers(self):
- """
+ """
@summary: Test to list, add and remove VPN Users
@Steps:
Step1: Creating a Network for the user
@@ -2597,7 +2612,7 @@ class TestIpAddresses(cloudstackTestCase):
list_ipaddresses_before,
"IP Addresses listed for newly created User"
)
- # Associating an IP Addresses to Network created
+ # Associating an IP Addresses to Network created
associated_ipaddress = PublicIPAddress.create(
self.userapiclient,
services=self.services["network"],
@@ -2738,11 +2753,12 @@ class TestIpAddresses(cloudstackTestCase):
# Destroying the VM
vm_created.delete(self.userapiclient)
vm_created.expung(self.apiClient)
+ self.cleanup.append(self.account)
return
-
+
@attr(tags=["advanced", "provisioning"])
def test_14_enable_disable_staticnat_fornonvpc(self):
- """
+ """
@summary: Test to Enable and Disable StaticNat for IP Address associated to Non VPC Network
@Steps:
Step1: Creating a Network for the user
@@ -2803,7 +2819,7 @@ class TestIpAddresses(cloudstackTestCase):
list_ipaddresses_before,
"IP Addresses listed for newly created User"
)
- # Associating an IP Addresses to Network created
+ # Associating an IP Addresses to Network created
associated_ipaddress1 = PublicIPAddress.create(
self.userapiclient,
services=self.services["network"],
@@ -2813,7 +2829,7 @@ class TestIpAddresses(cloudstackTestCase):
associated_ipaddress1,
"Failed to Associate IP Address"
)
- # Associating another IP Addresses to Network created
+ # Associating another IP Addresses to Network created
associated_ipaddress2 = PublicIPAddress.create(
self.userapiclient,
services=self.services["network"],
@@ -2913,11 +2929,12 @@ class TestIpAddresses(cloudstackTestCase):
# Destroying the VM
vm_created.delete(self.userapiclient)
vm_created.expung(self.apiClient)
+ self.cleanup.append(self.account)
return
-
+
@attr(tags=["advanced", "provisioning"])
def test_15_enable_disable_staticnat_forvpc(self):
- """
+ """
@summary: Test to Enable and Disable StaticNat for IP Address associated to VPC Network
@Steps:
Step1: Creating a VPC
@@ -2955,12 +2972,12 @@ class TestIpAddresses(cloudstackTestCase):
vpc_created,
"VPC Creation Failed"
)
- # Listing the vpc for a user after creating a vpc
+ # Listing the vpc for a user after creating a vpc
list_vpc_after = VPC.list(self.userapiclient)
status = validateList(list_vpc_after)
self.assertEquals(
- PASS,
- status[0],
+ PASS,
+ status[0],
"list VPC not as expected"
)
# Verifying the list vpc size is increased by 1
@@ -2969,25 +2986,25 @@ class TestIpAddresses(cloudstackTestCase):
len(list_vpc_after),
"list VPC not equal as expected"
)
- #List network offering for vpc = true
+ # List network offering for vpc = true
network_offering_vpc_true_list = NetworkOffering.list(
self.userapiclient,
- forvpc = "true",
- zoneid = self.zone.id,
- supportedServices = "SourceNat,PortForwarding,StaticNat",
- state = "Enabled"
+ forvpc="true",
+ zoneid=self.zone.id,
+ supportedServices="SourceNat,PortForwarding,StaticNat",
+ state="Enabled"
)
status = validateList(network_offering_vpc_true_list)
- self.assertEquals(PASS, status[0], "Default network offering not present for vpc = true with PortForwarding")
- # Creating network under VPC
+ self.assertEquals(PASS, status[0], "Default network offering not present for vpc = true with PortForwarding")
+ # Creating network under VPC
network_created = Network.create(
self.userapiclient,
self.services["ntwk"],
- networkofferingid = network_offering_vpc_true_list[0].id,
- vpcid = vpc_created.id,
+ networkofferingid=network_offering_vpc_true_list[0].id,
+ vpcid=vpc_created.id,
zoneid=self.zone.id,
- gateway= self.services["ntwk"]["gateway"],
- netmask = self.services["ntwk"]["netmask"]
+ gateway=self.services["ntwk"]["gateway"],
+ netmask=self.services["ntwk"]["netmask"]
)
self.assertIsNotNone(
network_created,
@@ -3000,8 +3017,8 @@ class TestIpAddresses(cloudstackTestCase):
)
status = validateList(list_ipaddresses_before)
self.assertEquals(
- PASS,
- status[0],
+ PASS,
+ status[0],
"list IP Addresses not as expected"
)
# Verifying the list vpc size is increased by 1
@@ -3010,7 +3027,7 @@ class TestIpAddresses(cloudstackTestCase):
len(list_ipaddresses_before),
"list IP Addresses not equal as expected"
)
- # Associating an IP Addresses to VPC created
+ # Associating an IP Addresses to VPC created
associated_ipaddress = PublicIPAddress.create(
self.userapiclient,
services=self.services["network"],
@@ -3113,11 +3130,12 @@ class TestIpAddresses(cloudstackTestCase):
# Destroying the VM
vm_created.delete(self.userapiclient)
vm_created.expung(self.apiClient)
+ self.cleanup.append(self.account)
return
-
+
@attr(tags=["advanced", "provisioning"])
def test_16_create_delete_ipforwardingrule(self):
- """
+ """
@summary: Test to list, create and delete IP Forwarding Rules for IP Address
@Steps:
Step1: Creating a Network for the user
@@ -3183,7 +3201,7 @@ class TestIpAddresses(cloudstackTestCase):
list_ipaddresses_before,
"IP Addresses listed for newly created User"
)
- # Associating an IP Addresses to Network created
+ # Associating an IP Addresses to Network created
associated_ipaddress1 = PublicIPAddress.create(
self.userapiclient,
services=self.services["network"],
@@ -3193,7 +3211,7 @@ class TestIpAddresses(cloudstackTestCase):
associated_ipaddress1,
"Failed to Associate IP Address"
)
- # Associating another IP Addresses to Network created
+ # Associating another IP Addresses to Network created
associated_ipaddress2 = PublicIPAddress.create(
self.userapiclient,
services=self.services["network"],
@@ -3320,11 +3338,12 @@ class TestIpAddresses(cloudstackTestCase):
# Destroying the VM
vm_created.delete(self.userapiclient)
vm_created.expung(self.apiClient)
+ self.cleanup.append(self.account)
return
-
+
@attr(tags=["advanced", "provisioning"])
def test_17_create_update_autoscalepolicy(self):
- """
+ """
@summary: Test to list, create and update Autoscale Policy
@Steps:
Step1: Creating a Network Offering for Supported Service LB with Netscaler
@@ -3346,238 +3365,264 @@ class TestIpAddresses(cloudstackTestCase):
Step17: Updating Autoscale Policy created in step13 with condition2
Step18: Verifying Autoscale policy is updated with condition2
"""
- # Listing Network Offerings
- list_nwoff_before = NetworkOffering.list(
- self.apiClient,
- forvpc="false",
- guestiptype="Isolated",
- state="Enabled",
- supportedservices="SourceNat,Lb",
- zoneid=self.zone.id
- )
- # Creating Network Offerign with LB as Netscalar
- nwoff_created = NetworkOffering.create(
- self.apiClient,
- self.services["nw_off_isolated_netscaler"]
- )
- self.assertIsNotNone(
- nwoff_created,
- "Failed to Create Network Offering with LB sercvice for Netscaler"
- )
- # Enable Network offering
- nwoff_created.update(self.apiClient, state='Enabled')
- # Listing Network Offerings again
- list_nwoff_after = NetworkOffering.list(
- self.apiClient,
- forvpc="false",
- guestiptype="Isolated",
- state="Enabled",
- supportedservices="SourceNat,Lb",
- zoneid=self.zone.id
- )
- self.assertEquals(
- len(list_nwoff_before)+1,
- len(list_nwoff_after),
- "Failed to create Network Offering"
- )
- # Creating a Network Using the Network Offering
- network = Network.create(
- self.userapiclient,
- self.services["network"],
- accountid=self.account.name,
- domainid=self.domain.id,
- networkofferingid=nwoff_created.id,
- zoneid=self.zone.id
- )
- self.assertIsNotNone(
- network,
- "Network creation failed"
- )
- self.cleanup.append(network)
- self.cleanup.append(nwoff_created)
- # Launching a Virtual Machine
- vm_created = VirtualMachine.create(
- self.userapiclient,
- self.services["virtual_machine"],
- accountid=self.account.name,
- domainid=self.account.domainid,
- networkids=network.id,
- serviceofferingid=self.service_offering.id,
- )
- self.assertIsNotNone(
- vm_created,
- "Failed to launch a VM under network created"
- )
- # Listing all the IP Addresses for a user
- list_ipaddresses_before = PublicIPAddress.list(
- self.userapiclient,
- listall=self.services["listall"]
- )
- status = validateList(list_ipaddresses_before)
- self.assertEquals(
- PASS,
- status[0],
- "IP Addresses Association Failed while launching a VM"
- )
- # Verifying the length of the list is 1
- self.assertEqual(
- 1,
- len(list_ipaddresses_before),
- "IP Addresses Association Failed while launching a VM"
- )
- # Associating an IP Addresses to Network created
- associated_ipaddress = PublicIPAddress.create(
- self.userapiclient,
- services=self.services["network"],
- networkid=network.id
- )
- self.assertIsNotNone(
- associated_ipaddress,
- "Failed to Associate IP Address"
- )
- # Listing all the IP Addresses for a user
- list_ipaddresses_after = PublicIPAddress.list(
- self.userapiclient,
- listall=self.services["listall"]
- )
- status = validateList(list_ipaddresses_after)
- self.assertEquals(
- PASS,
- status[0],
- "IP Addresses Association Failed"
- )
- # Verifying the length of the list is 1
- self.assertEqual(
- 2,
- len(list_ipaddresses_after),
- "Number of IP Addresses associated are not matching expected"
- )
- # Listing Counters
- list_counters = Autoscale.listCounters(
+ if self.hypervisor.lower() == 'kvm':
+ raise unittest.SkipTest("ScaleVM is not supported on KVM. Hence, skipping the test")
+
+ list_physical_networks = PhysicalNetwork.list(
+ self.apiClient,
+ zoneid=self.zone.id
+ )
+ physical_networks_size = 0
+ if list_physical_networks is not None:
+ physical_networks_size = len(list_physical_networks)
+
+ run_flag = False
+ for i in range(0, len(list_physical_networks)):
+ list_network_serviceprovider = NetworkServiceProvider.list(
+ self.apiClient,
+ physicalnetworkid=list_physical_networks[i].id
+ )
+ for j in range(0, len(list_network_serviceprovider)):
+ if((list_network_serviceprovider[j].name == 'Netscaler') and (list_network_serviceprovider[j].state == 'Enabled')):
+ run_flag = True
+ break
+
+ if(run_flag == False):
+ self.debug("Netscaler is not enabled and auto scale VM is applicable only for Netscaler")
+ else:
+ # Listing Network Offerings
+ list_nwoff_before = NetworkOffering.list(
+ self.apiClient,
+ forvpc="false",
+ guestiptype="Isolated",
+ state="Enabled",
+ supportedservices="SourceNat,Lb",
+ zoneid=self.zone.id
+ )
+ # Creating Network Offerign with LB as Netscalar
+ nwoff_created = NetworkOffering.create(
+ self.apiClient,
+ self.services["nw_off_isolated_netscaler"]
+ )
+ self.assertIsNotNone(
+ nwoff_created,
+ "Failed to Create Network Offering with LB sercvice for Netscaler"
+ )
+ # Enable Network offering
+ nwoff_created.update(self.apiClient, state='Enabled')
+ # Listing Network Offerings again
+ list_nwoff_after = NetworkOffering.list(
+ self.apiClient,
+ forvpc="false",
+ guestiptype="Isolated",
+ state="Enabled",
+ supportedservices="SourceNat,Lb",
+ zoneid=self.zone.id
+ )
+ self.assertEquals(
+ len(list_nwoff_before) + 1,
+ len(list_nwoff_after),
+ "Failed to create Network Offering"
+ )
+ # Creating a Network Using the Network Offering
+ network = Network.create(
+ self.userapiclient,
+ self.services["network"],
+ accountid=self.account.name,
+ domainid=self.domain.id,
+ networkofferingid=nwoff_created.id,
+ zoneid=self.zone.id
+ )
+ self.assertIsNotNone(
+ network,
+ "Network creation failed"
+ )
+ self.cleanup.append(network)
+ self.cleanup.append(nwoff_created)
+ # Launching a Virtual Machine
+ vm_created = VirtualMachine.create(
self.userapiclient,
+ self.services["virtual_machine"],
+ accountid=self.account.name,
+ domainid=self.account.domainid,
+ networkids=network.id,
+ serviceofferingid=self.service_offering.id,
)
- status = validateList(list_counters)
- self.assertEquals(
- PASS,
- status[0],
- "Failed to list counters"
- )
- # Listing Conditions
- list_conditions_before = Autoscale.listConditions(
+ self.assertIsNotNone(
+ vm_created,
+ "Failed to launch a VM under network created"
+ )
+ # Listing all the IP Addresses for a user
+ list_ipaddresses_before = PublicIPAddress.list(
+ self.userapiclient,
+ listall=self.services["listall"]
+ )
+ status = validateList(list_ipaddresses_before)
+ self.assertEquals(
+ PASS,
+ status[0],
+ "IP Addresses Association Failed while launching a VM"
+ )
+ # Verifying the length of the list is 1
+ self.assertEqual(
+ 1,
+ len(list_ipaddresses_before),
+ "IP Addresses Association Failed while launching a VM"
+ )
+ # Associating an IP Addresses to Network created
+ associated_ipaddress = PublicIPAddress.create(
+ self.userapiclient,
+ services=self.services["network"],
+ networkid=network.id
+ )
+ self.assertIsNotNone(
+ associated_ipaddress,
+ "Failed to Associate IP Address"
+ )
+ # Listing all the IP Addresses for a user
+ list_ipaddresses_after = PublicIPAddress.list(
self.userapiclient,
- listall=self.services["listall"],
- account=self.account.name,
- domainid=self.domain.id
+ listall=self.services["listall"]
)
- self.assertIsNone(
- list_conditions_before,
- "Listed Conditions for newly created user"
- )
- # Creating first Condition
- condition_created1 = Autoscale.createCondition(
- self.userapiclient,
- counterid=list_counters[0].id,
- relationaloperator='GT',
- threshold='1000'
- )
- self.assertIsNotNone(
- condition_created1,
- "Failed to create Condition"
- )
- # Creating second Condition
- condition_created2 = Autoscale.createCondition(
- self.userapiclient,
- counterid=list_counters[0].id,
- relationaloperator='GT',
- threshold='1500'
- )
- self.assertIsNotNone(
- condition_created2,
- "Failed to create Condition"
- )
- # Listing Conditions again
- list_conditions_after = Autoscale.listConditions(
- self.userapiclient,
- listall=self.services["listall"],
- account=self.account.name,
- domainid=self.domain.id
- )
- status = validateList(list_conditions_after)
- self.assertEquals(
- PASS,
- status[0],
- "Failed to list Conditions after creation"
- )
- # Listing Autoscale policies
- list_autoscalepolicies_before = Autoscale.listAutoscalePolicies(
- self.userapiclient,
- listall=self.services["listall"]
- )
- # Verifying no Autoscale policies are listed
- self.assertIsNone(
- list_autoscalepolicies_before,
- "Autoscale policies listed"
- )
- # Creating Autoscale Policy
- autoscalepolicy_created = Autoscale.createAutoscalePolicy(
- self.userapiclient,
- action='scaleup',
- conditionids=condition_created1.id,
- duration='100',
- quiettime='100'
- )
- self.assertIsNotNone(
- autoscalepolicy_created,
- "Failed to create Autoscale VM Policy"
- )
- # Verifying autoscalepolicy is created using condition1
- self.assertEquals(
- condition_created1.id,
- autoscalepolicy_created.conditions[0].id,
- "Autoscale Policy not created by given condition"
- )
- # Listing Autoscale policies
- list_autoscalepolicies_after = Autoscale.listAutoscalePolicies(
- self.userapiclient,
- listall=self.services["listall"]
- )
- status = validateList(list_autoscalepolicies_after)
- self.assertEquals(
- PASS,
- status[0],
- "Failed to list Autoscale Policy after creation"
- )
- self.assertEquals(
- 1,
- len(list_autoscalepolicies_after),
- "Autoscale Policies count is not matching"
- )
- # Updating Autoscale Policy
- autoscalepolicy_updated = Autoscale.updateAutoscalePolicy(
- self.userapiclient,
- id=autoscalepolicy_created.id,
- conditionids=condition_created2.id,
- duration='100',
- quiettime='100'
- )
- self.assertIsNotNone(
- autoscalepolicy_updated,
- "Failed to update Autoscale Policy"
+ status = validateList(list_ipaddresses_after)
+ self.assertEquals(
+ PASS,
+ status[0],
+ "IP Addresses Association Failed"
+ )
+ # Verifying the length of the list is 1
+ self.assertEqual(
+ 2,
+ len(list_ipaddresses_after),
+ "Number of IP Addresses associated are not matching expected"
)
- # Verifying the Autoscale Policy is updated
- self.assertEquals(
- condition_created2.id,
- autoscalepolicy_updated.conditions[0].id,
- "Autoscale Policy not updated to given condition"
- )
- # Destroying the VM
- vm_created.delete(self.userapiclient)
- vm_created.expung(self.apiClient)
+ # Listing Counters
+ list_counters = Autoscale.listCounters(
+ self.userapiclient,
+ )
+ status = validateList(list_counters)
+ self.assertEquals(
+ PASS,
+ status[0],
+ "Failed to list counters"
+ )
+ # Listing Conditions
+ list_conditions_before = Autoscale.listConditions(
+ self.userapiclient,
+ listall=self.services["listall"],
+ account=self.account.name,
+ domainid=self.domain.id
+ )
+ self.assertIsNone(
+ list_conditions_before,
+ "Listed Conditions for newly created user"
+ )
+ # Creating first Condition
+ condition_created1 = Autoscale.createCondition(
+ self.userapiclient,
+ counterid=list_counters[0].id,
+ relationaloperator='GT',
+ threshold='1000'
+ )
+ self.assertIsNotNone(
+ condition_created1,
+ "Failed to create Condition"
+ )
+ # Creating second Condition
+ condition_created2 = Autoscale.createCondition(
+ self.userapiclient,
+ counterid=list_counters[0].id,
+ relationaloperator='GT',
+ threshold='1500'
+ )
+ self.assertIsNotNone(
+ condition_created2,
+ "Failed to create Condition"
+ )
+ # Listing Conditions again
+ list_conditions_after = Autoscale.listConditions(
+ self.userapiclient,
+ listall=self.services["listall"],
+ account=self.account.name,
+ domainid=self.domain.id
+ )
+ status = validateList(list_conditions_after)
+ self.assertEquals(
+ PASS,
+ status[0],
+ "Failed to list Conditions after creation"
+ )
+ # Listing Autoscale policies
+ list_autoscalepolicies_before = Autoscale.listAutoscalePolicies(
+ self.userapiclient,
+ listall=self.services["listall"]
+ )
+ # Verifying no Autoscale policies are listed
+ self.assertIsNone(
+ list_autoscalepolicies_before,
+ "Autoscale policies listed"
+ )
+ # Creating Autoscale Policy
+ autoscalepolicy_created = Autoscale.createAutoscalePolicy(
+ self.userapiclient,
+ action='scaleup',
+ conditionids=condition_created1.id,
+ duration='100',
+ quiettime='100'
+ )
+ self.assertIsNotNone(
+ autoscalepolicy_created,
+ "Failed to create Autoscale VM Policy"
+ )
+ # Verifying autoscalepolicy is created using condition1
+ self.assertEquals(
+ condition_created1.id,
+ autoscalepolicy_created.conditions[0].id,
+ "Autoscale Policy not created by given condition"
+ )
+ # Listing Autoscale policies
+ list_autoscalepolicies_after = Autoscale.listAutoscalePolicies(
+ self.userapiclient,
+ listall=self.services["listall"]
+ )
+ status = validateList(list_autoscalepolicies_after)
+ self.assertEquals(
+ PASS,
+ status[0],
+ "Failed to list Autoscale Policy after creation"
+ )
+ self.assertEquals(
+ 1,
+ len(list_autoscalepolicies_after),
+ "Autoscale Policies count is not matching"
+ )
+ # Updating Autoscale Policy
+ autoscalepolicy_updated = Autoscale.updateAutoscalePolicy(
+ self.userapiclient,
+ id=autoscalepolicy_created.id,
+ conditionids=condition_created2.id,
+ duration='100',
+ quiettime='100'
+ )
+ self.assertIsNotNone(
+ autoscalepolicy_updated,
+ "Failed to update Autoscale Policy"
+ )
+ # Verifying the Autoscale Policy is updated
+ self.assertEquals(
+ condition_created2.id,
+ autoscalepolicy_updated.conditions[0].id,
+ "Autoscale Policy not updated to given condition"
+ )
+ # Destroying the VM
+ vm_created.delete(self.userapiclient)
+ vm_created.expung(self.apiClient)
+ self.cleanup.append(self.account)
return
-
+
@attr(tags=["advanced", "provisioning"])
def test_18_create_update_autoscaleprofiles(self):
- """
+ """
@summary: Test to list, create and update Autoscale VM Profiles
@Steps:
Step1: Creating a Network Offering for Supported Service LB with Netscaler
@@ -3597,277 +3642,303 @@ class TestIpAddresses(cloudstackTestCase):
Step15: Updating Autoscale VM profile with destroy vm grace period
Step16: Verifying that Autoscale VM is updated
"""
- # Listing Network Offerings
- list_nwoff_before = NetworkOffering.list(
- self.apiClient,
- forvpc="false",
- guestiptype="Isolated",
- state="Enabled",
- supportedservices="SourceNat,Lb",
- zoneid=self.zone.id
- )
- # Creating Network Offerign with LB as Netscalar
- nwoff_created = NetworkOffering.create(
- self.apiClient,
- self.services["nw_off_isolated_netscaler"]
- )
- self.assertIsNotNone(
- nwoff_created,
- "Failed to Create Network Offering with LB sercvice for Netscaler"
- )
- # Enable Network offering
- nwoff_created.update(self.apiClient, state='Enabled')
- # Listing Network Offerings again
- list_nwoff_after = NetworkOffering.list(
- self.apiClient,
- forvpc="false",
- guestiptype="Isolated",
- state="Enabled",
- supportedservices="SourceNat,Lb",
- zoneid=self.zone.id
- )
- self.assertEquals(
- len(list_nwoff_before)+1,
- len(list_nwoff_after),
- "Failed to create Network Offering"
- )
- # Creating a Network Using the Network Offering
- network = Network.create(
- self.userapiclient,
- self.services["network"],
- accountid=self.account.name,
- domainid=self.domain.id,
- networkofferingid=nwoff_created.id,
- zoneid=self.zone.id
- )
- self.assertIsNotNone(
- network,
- "Network creation failed"
- )
- self.cleanup.append(network)
- self.cleanup.append(nwoff_created)
- # Launching a Virtual Machine
- vm_created = VirtualMachine.create(
- self.userapiclient,
- self.services["virtual_machine"],
- accountid=self.account.name,
- domainid=self.account.domainid,
- networkids=network.id,
- serviceofferingid=self.service_offering.id,
- )
- self.assertIsNotNone(
- vm_created,
- "Failed to launch a VM under network created"
- )
- # Listing all the IP Addresses for a user
- list_ipaddresses_before = PublicIPAddress.list(
- self.userapiclient,
- listall=self.services["listall"]
- )
- status = validateList(list_ipaddresses_before)
- self.assertEquals(
- PASS,
- status[0],
- "IP Addresses Association Failed while launching a VM"
- )
- # Verifying the length of the list is 1
- self.assertEqual(
- 1,
- len(list_ipaddresses_before),
- "IP Addresses Association Failed while launching a VM"
- )
- # Associating an IP Addresses to Network created
- associated_ipaddress = PublicIPAddress.create(
- self.userapiclient,
- services=self.services["network"],
- networkid=network.id
- )
- self.assertIsNotNone(
- associated_ipaddress,
- "Failed to Associate IP Address"
+ if self.hypervisor.lower() == 'kvm':
+ raise unittest.SkipTest("ScaleVM is not supported on KVM. Hence, skipping the test")
+
+ list_physical_networks = PhysicalNetwork.list(
+ self.apiClient,
+ zoneid=self.zone.id
+ )
+ physical_networks_size = 0
+ if list_physical_networks is not None:
+ physical_networks_size = len(list_physical_networks)
+
+ run_flag = False
+ for i in range(0, len(list_physical_networks)):
+ list_network_serviceprovider = NetworkServiceProvider.list(
+ self.apiClient,
+ physicalnetworkid=list_physical_networks[i].id
+ )
+ for j in range(0, len(list_network_serviceprovider)):
+ if((list_network_serviceprovider[j].name == 'Netscaler') and (list_network_serviceprovider[j].state == 'Enabled')):
+ run_flag = True
+ break
+
+ if(run_flag == False):
+ self.debug("Netscaler is not enabled and auto scale VM is applicable only for Netscaler")
+ else:
+ # Listing Network Offerings
+ list_nwoff_before = NetworkOffering.list(
+ self.apiClient,
+ forvpc="false",
+ guestiptype="Isolated",
+ state="Enabled",
+ supportedservices="SourceNat,Lb",
+ zoneid=self.zone.id
+ )
+ # Creating Network Offerign with LB as Netscalar
+ nwoff_created = NetworkOffering.create(
+ self.apiClient,
+ self.services["nw_off_isolated_netscaler"]
+ )
+ self.assertIsNotNone(
+ nwoff_created,
+ "Failed to Create Network Offering with LB sercvice for Netscaler"
+ )
+ # Enable Network offering
+ nwoff_created.update(self.apiClient, state='Enabled')
+ # Listing Network Offerings again
+ list_nwoff_after = NetworkOffering.list(
+ self.apiClient,
+ forvpc="false",
+ guestiptype="Isolated",
+ state="Enabled",
+ supportedservices="SourceNat,Lb",
+ zoneid=self.zone.id
+ )
+ self.assertEquals(
+ len(list_nwoff_before) + 1,
+ len(list_nwoff_after),
+ "Failed to create Network Offering"
+ )
+ # Creating a Network Using the Network Offering
+ network = Network.create(
+ self.userapiclient,
+ self.services["network"],
+ accountid=self.account.name,
+ domainid=self.domain.id,
+ networkofferingid=nwoff_created.id,
+ zoneid=self.zone.id
+ )
+ self.assertIsNotNone(
+ network,
+ "Network creation failed"
+ )
+ self.cleanup.append(network)
+ self.cleanup.append(nwoff_created)
+ # Launching a Virtual Machine
+ vm_created = VirtualMachine.create(
+ self.userapiclient,
+ self.services["virtual_machine"],
+ accountid=self.account.name,
+ domainid=self.account.domainid,
+ networkids=network.id,
+ serviceofferingid=self.service_offering.id,
+ )
+ self.assertIsNotNone(
+ vm_created,
+ "Failed to launch a VM under network created"
+ )
+ # Listing all the IP Addresses for a user
+ list_ipaddresses_before = PublicIPAddress.list(
+ self.userapiclient,
+ listall=self.services["listall"]
+ )
+ status = validateList(list_ipaddresses_before)
+ self.assertEquals(
+ PASS,
+ status[0],
+ "IP Addresses Association Failed while launching a VM"
+ )
+ # Verifying the length of the list is 1
+ self.assertEqual(
+ 1,
+ len(list_ipaddresses_before),
+ "IP Addresses Association Failed while launching a VM"
)
- # Listing all the IP Addresses for a user
- list_ipaddresses_after = PublicIPAddress.list(
- self.userapiclient,
- listall=self.services["listall"]
- )
- status = validateList(list_ipaddresses_after)
- self.assertEquals(
- PASS,
- status[0],
- "IP Addresses Association Failed"
- )
- # Verifying the length of the list is 1
- self.assertEqual(
- 2,
- len(list_ipaddresses_after),
- "Number of IP Addresses associated are not matching expected"
- )
- # Listing Service Offerings
- list_service_offerings = ServiceOffering.list(
- self.userapiclient,
- listall=self.services["listall"],
- issystem='false'
- )
- status = validateList(list_service_offerings)
- self.assertEquals(
- PASS,
- status[0],
- "Failed to list Service Offerings"
- )
- # Listing Users
- list_users = User.list(
- self.apiClient,
- listall=self.services["listall"],
- account=self.account.name,
- domainid=self.domain.id
- )
- status = validateList(list_users)
- self.assertEquals(
- PASS,
- status[0],
- "Failed to list Users"
- )
- # Listing Featured Templates
- list_templates_featured = Template.list(
- self.userapiclient,
- listall=self.services["listall"],
- templatefilter="featured",
- zoneid=self.zone.id
- )
- status = validateList(list_templates_featured)
- self.assertEquals(
- PASS,
- status[0],
- "Failed to list Featured Templates"
- )
- # Listing Community Templates
- list_templates_community = Template.list(
- self.userapiclient,
- listall=self.services["listall"],
- templatefilter="community",
- zoneid=self.zone.id
- )
- self.assertIsNone(
- list_templates_community,
- "Community Templates listed for newly created User"
- )
- # Listing selfexecutable Templates
- list_templates_selfexecutable = Template.list(
- self.userapiclient,
- listall=self.services["listall"],
- templatefilter="selfexecutable",
- zoneid=self.zone.id
- )
- self.assertIsNone(
- list_templates_selfexecutable,
- "Self Executable Templates listed for newly created User"
- )
- # Listing Autoscale VM Profiles
- list_autoscalevm_profiles_before = Autoscale.listAutoscaleVmPofiles(
- self.userapiclient,
- listall=self.services["listall"]
- )
- self.assertIsNone(
- list_autoscalevm_profiles_before,
- "Autoscale VM Profiles listed"
- )
- # Creating Autoscale VM Profile
- counterparam = { "snmpcommunity": "public", "snmpport": "161"}
- autoscalevm_profile = Autoscale.createAutoscaleVmProfile(
- self.userapiclient,
- serviceofferingid=list_service_offerings[0].id,
- zoneid=self.zone.id,
- templateid=list_templates_featured[0].id,
- autoscaleuserid=list_users[0].id,
- destroyvmgraceperiod='100',
- counterparam=counterparam
- )
- self.assertIsNotNone(
- autoscalevm_profile,
- "Failed to create Autoscale VM Profile"
+ # Associating an IP Addresses to Network created
+ associated_ipaddress = PublicIPAddress.create(
+ self.userapiclient,
+ services=self.services["network"],
+ networkid=network.id
+ )
+ self.assertIsNotNone(
+ associated_ipaddress,
+ "Failed to Associate IP Address"
+ )
+ # Listing all the IP Addresses for a user
+ list_ipaddresses_after = PublicIPAddress.list(
+ self.userapiclient,
+ listall=self.services["listall"]
+ )
+ status = validateList(list_ipaddresses_after)
+ self.assertEquals(
+ PASS,
+ status[0],
+ "IP Addresses Association Failed"
+ )
+ # Verifying the length of the list is 1
+ self.assertEqual(
+ 2,
+ len(list_ipaddresses_after),
+ "Number of IP Addresses associated are not matching expected"
)
- # Listing Autoscale VM Profiles
- list_autoscalevm_profiles_after = Autoscale.listAutoscaleVmPofiles(
- self.userapiclient,
- listall=self.services["listall"]
- )
- status = validateList(list_autoscalevm_profiles_after)
- self.assertEquals(
- PASS,
- status[0],
- "Failed to list Autoscale VM Profile after creation"
- )
- # Verifying only 1 autoscale vm profile is created
- self.assertEquals(
- 1,
- len(list_autoscalevm_profiles_after),
- "Count of Autoscale VM profiles listed is not matching"
- )
- # Listing the Autoscale VM Profile by id
- list_autoscalvmprofile = Autoscale.listAutoscaleVmPofiles(
- self.userapiclient,
- listall=self.services["listall"],
- id=autoscalevm_profile.id
- )
- status = validateList(list_autoscalvmprofile)
- self.assertEquals(
- PASS,
- status[0],
- "Failed to list Autoscale VM Profile by Id after creation"
- )
- # Verifying details of the listed Autoscale VM Profile
- # Creating expected and actual values dictionaries
- expected_dict = {
- "id":autoscalevm_profile.id,
- "account":self.account.name,
- "domainid":self.domain.id,
- "autoscaleuserid":list_users[0].id,
- "serviceofferingid":list_service_offerings[0].id,
- "zoneid":self.zone.id,
- "templateid":list_templates_featured[0].id,
- "destroyvmgraceperiod":autoscalevm_profile.destroyvmgraceperiod
- }
- actual_dict = {
- "id":list_autoscalvmprofile[0].id,
- "account":list_autoscalvmprofile[0].account,
- "domainid":list_autoscalvmprofile[0].domainid,
- "autoscaleuserid":list_autoscalvmprofile[0].autoscaleuserid,
- "serviceofferingid":list_autoscalvmprofile[0].serviceofferingid,
- "zoneid":list_autoscalvmprofile[0].zoneid,
- "templateid":list_autoscalvmprofile[0].templateid,
- "destroyvmgraceperiod":list_autoscalvmprofile[0].destroyvmgraceperiod
- }
- autoscalevm_profile_status = self.__verify_values(
- expected_dict,
- actual_dict
+ # Listing Service Offerings
+ list_service_offerings = ServiceOffering.list(
+ self.userapiclient,
+ listall=self.services["listall"],
+ issystem='false'
)
- self.assertEqual(
- True,
- autoscalevm_profile_status,
- "Created Autoscale VM Profile details are not as expected"
- )
- # Updating destroyvmgrageperiod for created Autoscale VM Profile
- autoscalevm_profile_updated = Autoscale.updateAutoscaleVMProfile(
- self.userapiclient,
- id=autoscalevm_profile.id,
- autoscaleuserid=list_users[0].id,
- destroyvmgraceperiod='200',
- templateid=list_templates_featured[0].id,
- )
- self.assertIsNotNone(
- autoscalevm_profile_updated,
- "Failed to update Autoscale VM Profile"
+ status = validateList(list_service_offerings)
+ self.assertEquals(
+ PASS,
+ status[0],
+ "Failed to list Service Offerings"
+ )
+ # Listing Users
+ list_users = User.list(
+ self.apiClient,
+ listall=self.services["listall"],
+ account=self.account.name,
+ domainid=self.domain.id
+ )
+ status = validateList(list_users)
+ self.assertEquals(
+ PASS,
+ status[0],
+ "Failed to list Users"
+ )
+ # Listing Featured Templates
+ list_templates_featured = Template.list(
+ self.userapiclient,
+ listall=self.services["listall"],
+ templatefilter="featured",
+ zoneid=self.zone.id
+ )
+ status = validateList(list_templates_featured)
+ self.assertEquals(
+ PASS,
+ status[0],
+ "Failed to list Featured Templates"
+ )
+ # Listing Community Templates
+ list_templates_community = Template.list(
+ self.userapiclient,
+ listall=self.services["listall"],
+ templatefilter="community",
+ zoneid=self.zone.id
+ )
+ self.assertIsNone(
+ list_templates_community,
+ "Community Templates listed for newly created User"
+ )
+ # Listing selfexecutable Templates
+ list_templates_selfexecutable = Template.list(
+
<TRUNCATED>
[3/3] git commit: updated refs/heads/4.4-forward to 89c35ab
Posted by gi...@apache.org.
CLOUDSTACK-6282: Modified IPAddress tests to fix the failures. Modified Instances, snapshots, templates tests to handle KVM Hypervisor
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/89c35abb
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/89c35abb
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/89c35abb
Branch: refs/heads/4.4-forward
Commit: 89c35abb4db0f362f9159ea39a6eb70ad4351921
Parents: 4970425
Author: VinayV <vi...@citrix.com>
Authored: Thu Jun 12 14:49:35 2014 +0530
Committer: Girish Shilamkar <gi...@clogeny.com>
Committed: Mon Jun 16 16:54:03 2014 +0530
----------------------------------------------------------------------
.../component/test_escalations_instances.py | 122 +-
.../component/test_escalations_ipaddresses.py | 1886 +++++++++---------
.../component/test_escalations_snapshots.py | 60 +-
.../component/test_escalations_templates.py | 97 +-
tools/marvin/marvin/config/test_data.py | 7 +
tools/marvin/marvin/lib/base.py | 2 +-
6 files changed, 1116 insertions(+), 1058 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/89c35abb/test/integration/component/test_escalations_instances.py
----------------------------------------------------------------------
diff --git a/test/integration/component/test_escalations_instances.py b/test/integration/component/test_escalations_instances.py
index 9e040db..4900ff6 100644
--- a/test/integration/component/test_escalations_instances.py
+++ b/test/integration/component/test_escalations_instances.py
@@ -15,52 +15,30 @@
# specific language governing permissions and limitations
# under the License.
-#Import Local Modules
-from marvin.cloudstackTestCase import cloudstackTestCase
-from marvin.cloudstackAPI import (createVolume,
- createTemplate)
-from marvin.lib.base import (Volume,
- Iso,
- VirtualMachine,
- Template,
- Snapshot,
- SecurityGroup,
- Account,
- Zone,
- Network,
- NetworkOffering,
- DiskOffering,
- ServiceOffering,
- VmSnapshot,
- SnapshotPolicy,
- SSHKeyPair,
- Resources,
- Configurations,
- VpnCustomerGateway,
- Hypervisor,
- VpcOffering,
- VPC,
- NetworkACL)
-from marvin.lib.common import (get_zone,
- get_domain,
- get_template,
- list_os_types)
-from marvin.lib.utils import (validateList,
- cleanup_resources,
- random_gen)
-from marvin.codes import (PASS, FAIL, EMPTY_LIST)
+# Import Local Modules
+from marvin.cloudstackTestCase import *
+from marvin.cloudstackException import *
+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 marvin.lib.utils import checkVolumeSize
+from marvin.codes import SUCCESS
from nose.plugins.attrib import attr
-import time
+from time import sleep
+from ctypes.wintypes import BOOLEAN
class TestListInstances(cloudstackTestCase):
@classmethod
def setUpClass(cls):
try:
- cls._cleanup = []
+ cls._cleanup = []
cls.testClient = super(TestListInstances, cls).getClsTestClient()
cls.api_client = cls.testClient.getApiClient()
cls.services = cls.testClient.getParsedTestDataConfig()
+ cls.hypervisor = cls.testClient.getHypervisorInfo()
# Get Domain, Zone, Template
cls.domain = get_domain(cls.api_client)
cls.zone = get_zone(cls.api_client, cls.testClient.getZoneForTests())
@@ -101,7 +79,7 @@ class TestListInstances(cloudstackTestCase):
cls.user = cls.account.user[0]
cls.userapiclient = cls.testClient.getUserApiClient(cls.user.username, cls.domain.name)
# Updating resource Limits
- for i in range(0,12):
+ for i in range(0, 12):
Resources.updateLimit(
cls.api_client,
account=cls.account.name,
@@ -124,7 +102,7 @@ class TestListInstances(cloudstackTestCase):
self.cleanup = []
def tearDown(self):
- #Clean up, terminate the created resources
+ # Clean up, terminate the created resources
cleanup_resources(self.apiClient, self.cleanup)
return
@@ -194,7 +172,7 @@ class TestListInstances(cloudstackTestCase):
list_instances_before,
"Virtual Machine already exists for newly created user"
)
- # If number of instances are less than (pagesize + 1), then creating them
+ # If number of instances are less than (pagesize + 1), then creating them
for i in range(0, (self.services["pagesize"] + 1)):
vm_created = VirtualMachine.create(
self.userapiclient,
@@ -216,7 +194,7 @@ class TestListInstances(cloudstackTestCase):
"Newly created VM name and the test data VM name are not matching"
)
- # Listing all the instances again after creating VM's
+ # Listing all the instances again after creating VM's
list_instances_after = VirtualMachine.list(self.userapiclient, listall=self.services["listall"])
status = validateList(list_instances_after)
self.assertEquals(
@@ -301,7 +279,7 @@ class TestListInstances(cloudstackTestCase):
"VM was not deleted"
)
return
-
+
@attr(tags=["advanced", "basic", "selfservice"])
def test_02_list_Running_vm(self):
"""
@@ -363,7 +341,7 @@ class TestListInstances(cloudstackTestCase):
)
running_vm = list_running_vms_after[0]
- #Creating expected and actual values dictionaries
+ # Creating expected and actual values dictionaries
expected_dict = {
"id":vm_created.id,
"name":vm_created.name,
@@ -456,7 +434,7 @@ class TestListInstances(cloudstackTestCase):
"Stopped VM list count is not matching"
)
stopped_vm = list_stopped_vms_after[0]
- #Creating expected and actual values dictionaries
+ # Creating expected and actual values dictionaries
expected_dict = {
"id":vm_created.id,
"name":vm_created.name,
@@ -564,7 +542,7 @@ class TestListInstances(cloudstackTestCase):
"Destroyed VM list count is not matching"
)
destroyed_vm = list_destroyed_vms_admin[0]
- #Creating expected and actual values dictionaries
+ # Creating expected and actual values dictionaries
expected_dict = {
"id":vm_created.id,
"name":vm_created.name,
@@ -666,7 +644,7 @@ class TestListInstances(cloudstackTestCase):
"Listing of VM by Id failed"
)
listed_vm = list_vm_byid[0]
- #Creating expected and actual values dictionaries
+ # Creating expected and actual values dictionaries
expected_dict = {
"id":vm_created.id,
"name":vm_created.name,
@@ -782,7 +760,7 @@ class TestListInstances(cloudstackTestCase):
"VM list by full name count is not matching"
)
# Verifying that the details of the listed VM are same as the VM created above
- #Creating expected and actual values dictionaries
+ # Creating expected and actual values dictionaries
expected_dict = {
"id":vms[0].id,
"name":vms[0].name,
@@ -916,7 +894,7 @@ class TestListInstances(cloudstackTestCase):
"Count of VM list by name and state is not matching"
)
# Verifying that the details of the listed VM are same as the VM created above
- #Creating expected and actual values dictionaries
+ # Creating expected and actual values dictionaries
expected_dict = {
"id":vm_created.id,
"name":vm_created.name,
@@ -1068,7 +1046,7 @@ class TestListInstances(cloudstackTestCase):
)
listed_vm = list_vms_after[0]
# Verifying that the details of the Listed VM are same as the VM deployed above
- #Creating expected and actual values dictionaries
+ # Creating expected and actual values dictionaries
expected_dict = {
"id":vm_created.id,
"name":vm_created.name,
@@ -1235,7 +1213,7 @@ class TestListInstances(cloudstackTestCase):
)
listed_vm = list_vms[0]
# Verifying that the details of the Listed VM are same as the VM deployed above
- #Creating expected and actual values dictionaries
+ # Creating expected and actual values dictionaries
expected_dict = {
"id":vm_created.id,
"name":vm_created.name,
@@ -1388,7 +1366,7 @@ class TestListInstances(cloudstackTestCase):
)
listed_vm = list_vms[0]
# Verifying that the details of the Listed VM are same as the VM deployed above
- #Creating expected and actual values dictionaries
+ # Creating expected and actual values dictionaries
expected_dict = {
"id":vm_created.id,
"name":vm_created.name,
@@ -1456,7 +1434,7 @@ class TestListInstances(cloudstackTestCase):
)
listed_vm = list_vms[0]
# Verifying that the details of the Listed VM are same as the VM deployed above
- #Creating expected and actual values dictionaries
+ # Creating expected and actual values dictionaries
expected_dict = {
"id":vm_created.id,
"name":vm_created.name,
@@ -1899,7 +1877,7 @@ class TestInstances(cloudstackTestCase):
cls.testClient = super(TestInstances, cls).getClsTestClient()
cls.api_client = cls.testClient.getApiClient()
cls.services = cls.testClient.getParsedTestDataConfig()
-
+ cls.hypervisor = cls.testClient.getHypervisorInfo()
# Get Domain, Zone, Template
cls.domain = get_domain(cls.api_client)
cls.zone = get_zone(cls.api_client, cls.testClient.getZoneForTests())
@@ -1941,7 +1919,7 @@ class TestInstances(cloudstackTestCase):
cls.user = cls.account.user[0]
cls.userapiclient = cls.testClient.getUserApiClient(cls.user.username, cls.domain.name)
# Updating resource Limits
- for i in range(0,12):
+ for i in range(0, 12):
Resources.updateLimit(
cls.api_client,
account=cls.account.name,
@@ -1963,7 +1941,7 @@ class TestInstances(cloudstackTestCase):
self.cleanup = []
def tearDown(self):
- #Clean up, terminate the created resources
+ # Clean up, terminate the created resources
cleanup_resources(self.apiClient, self.cleanup)
return
@@ -2024,6 +2002,8 @@ class TestInstances(cloudstackTestCase):
Step10: Detaching the ISO attached in step8
Step11: Verifying that detached ISO details are not associated with VM
"""
+ if self.hypervisor.lower() == 'kvm':
+ raise unittest.SkipTest("VM Snapshot is not supported on KVM. Hence, skipping the test")
# Listing all the VM's for a User
list_vms_before = VirtualMachine.list(
self.userapiclient,
@@ -2154,6 +2134,8 @@ class TestInstances(cloudstackTestCase):
Step12: Listing all the VM snapshots in Page 2 with page size
Step13: Verifying that size of the list is 0
"""
+ if self.hypervisor.lower() == 'kvm':
+ raise unittest.SkipTest("VM Snapshot is not supported on KVM. Hence, skipping the test")
# Listing all the VM's for a User
list_vms_before = VirtualMachine.list(
self.userapiclient,
@@ -2309,6 +2291,8 @@ class TestInstances(cloudstackTestCase):
Step10: Verifying that only 1 VM snapshot is having current flag set as true.
Step11: Verifying that the VM Snapshot with current flag set to true is the reverted snapshot in Step 8
"""
+ if self.hypervisor.lower() == 'kvm':
+ raise unittest.SkipTest("VM Snapshot is not supported on KVM. Hence, skipping the test")
# Listing all the VM's for a User
list_vms_before = VirtualMachine.list(
self.userapiclient,
@@ -2624,6 +2608,32 @@ class TestInstances(cloudstackTestCase):
list_volumes_page2,
"Volumes listed in page 2"
)
+ # Listing all the volumes for a VM again in page 1
+ list_volumes_page1 = Volume.list(
+ self.userapiclient,
+ listall=self.services["listall"],
+ virtualmachineid=vm_created.id,
+ page=1,
+ pagesize=self.services["pagesize"]
+ )
+ status = validateList(list_volumes_page1)
+ self.assertEquals(
+ PASS,
+ status[0],
+ "Volumes not listed in page1"
+ )
+ # Verifying that list size is equal to page size
+ self.assertEquals(
+ self.services["pagesize"],
+ len(list_volumes_page1),
+ "VM's volume count is not matching in page 1"
+ )
+ # Detaching all the volumes attached from VM
+ for i in range(0, len(list_volumes_page1)):
+ vm_created.detach_volume(
+ self.userapiclient,
+ list_volumes_page1[i]
+ )
return
@attr(tags=["advanced", "basic", "provisioning"])
@@ -2641,6 +2651,8 @@ class TestInstances(cloudstackTestCase):
Step5: Perform change service (scale up) the Running VM deployed in step1
Step6: Verifying that VM's service offerings is changed
"""
+ if self.hypervisor.lower() == 'kvm':
+ raise unittest.SkipTest("ScaleVM is not supported on KVM. Hence, skipping the test")
# Checking if Dynamic scaling of VM is supported or not
list_config = Configurations.list(
self.apiClient,
@@ -3445,4 +3457,4 @@ class TestInstances(cloudstackTestCase):
vm_securitygroups_flag,
"Security Groups in VM are not same as created"
)
- return
\ No newline at end of file
+ return