mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
CLOUDSTACK-6282-Modified IpAddresses, Instances, Templates, Snapshots tests to handle KVM and modified IPAddresses for failed list cases
This commit is contained in:
parent
3a3a3902b7
commit
99e4da15da
@ -16,41 +16,18 @@
|
||||
# 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)
|
||||
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):
|
||||
|
||||
@ -61,6 +38,7 @@ class TestListInstances(cloudstackTestCase):
|
||||
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())
|
||||
@ -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())
|
||||
@ -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,
|
||||
|
||||
@ -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())
|
||||
@ -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,6 +74,15 @@ 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
|
||||
@ -290,6 +293,7 @@ class TestIpAddresses(cloudstackTestCase):
|
||||
list_ipaddress_page2,
|
||||
"Disassociation of IP Address Failed"
|
||||
)
|
||||
self.cleanup.append(self.account)
|
||||
return
|
||||
|
||||
@attr(tags=["advanced", "provisioning"])
|
||||
@ -464,6 +468,7 @@ class TestIpAddresses(cloudstackTestCase):
|
||||
ipaddress_status,
|
||||
"Listed IP Address details are not as expected"
|
||||
)
|
||||
self.cleanup.append(self.account)
|
||||
return
|
||||
|
||||
@attr(tags=["advanced", "provisioning"])
|
||||
@ -615,6 +620,7 @@ class TestIpAddresses(cloudstackTestCase):
|
||||
ipaddress_status,
|
||||
"Listed IP Address details are not as expected"
|
||||
)
|
||||
self.cleanup.append(self.account)
|
||||
return
|
||||
|
||||
@attr(tags=["advanced", "provisioning"])
|
||||
@ -785,6 +791,7 @@ class TestIpAddresses(cloudstackTestCase):
|
||||
list_lbrules_after,
|
||||
"Failed to delete Load Balancer Rule"
|
||||
)
|
||||
self.cleanup.append(self.account)
|
||||
return
|
||||
|
||||
@attr(tags=["advanced", "provisioning"])
|
||||
@ -990,6 +997,7 @@ class TestIpAddresses(cloudstackTestCase):
|
||||
list_lbrules_after,
|
||||
"Failed to delete Load Balancer Rule"
|
||||
)
|
||||
self.cleanup.append(self.account)
|
||||
return
|
||||
|
||||
@attr(tags=["advanced", "provisioning"])
|
||||
@ -1186,6 +1194,7 @@ class TestIpAddresses(cloudstackTestCase):
|
||||
lbrule_status,
|
||||
"Updated Load Balancer Rule details are not as expected"
|
||||
)
|
||||
self.cleanup.append(self.account)
|
||||
return
|
||||
|
||||
@attr(tags=["advanced", "provisioning"])
|
||||
@ -1501,6 +1510,7 @@ 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"])
|
||||
@ -1737,6 +1747,7 @@ 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"])
|
||||
@ -1960,6 +1971,7 @@ 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"])
|
||||
@ -2183,6 +2195,7 @@ 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"])
|
||||
@ -2357,6 +2370,7 @@ class TestIpAddresses(cloudstackTestCase):
|
||||
list_firewalls_after,
|
||||
"Failed to create Firewall Rule"
|
||||
)
|
||||
self.cleanup.append(self.account)
|
||||
return
|
||||
|
||||
@attr(tags=["advanced", "provisioning"])
|
||||
@ -2528,6 +2542,7 @@ class TestIpAddresses(cloudstackTestCase):
|
||||
list_vpns_after,
|
||||
"Failed to create Remote Access VPN"
|
||||
)
|
||||
self.cleanup.append(self.account)
|
||||
return
|
||||
|
||||
@attr(tags=["advanced", "provisioning"])
|
||||
@ -2738,6 +2753,7 @@ 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"])
|
||||
@ -2913,6 +2929,7 @@ 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"])
|
||||
@ -3113,6 +3130,7 @@ 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"])
|
||||
@ -3320,6 +3338,7 @@ 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"])
|
||||
@ -3346,6 +3365,31 @@ class TestIpAddresses(cloudstackTestCase):
|
||||
Step17: Updating Autoscale Policy created in step13 with condition2
|
||||
Step18: Verifying Autoscale policy is updated with condition2
|
||||
"""
|
||||
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,
|
||||
@ -3573,6 +3617,7 @@ 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"])
|
||||
@ -3597,6 +3642,31 @@ class TestIpAddresses(cloudstackTestCase):
|
||||
Step15: Updating Autoscale VM profile with destroy vm grace period
|
||||
Step16: Verifying that Autoscale VM is updated
|
||||
"""
|
||||
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,
|
||||
@ -3868,6 +3938,7 @@ 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"])
|
||||
@ -3890,6 +3961,31 @@ class TestIpAddresses(cloudstackTestCase):
|
||||
Step13: Updating Autoscale VM group and verifying it was updated
|
||||
Step14: Enabling Autoscale VM group and verifying it was enabled
|
||||
"""
|
||||
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,
|
||||
@ -3938,7 +4034,7 @@ class TestIpAddresses(cloudstackTestCase):
|
||||
"Network creation failed"
|
||||
)
|
||||
self.cleanup.append(network)
|
||||
self.cleanup.append(nwoff_created)
|
||||
# self.cleanup.append(nwoff_created)
|
||||
# Launching a Virtual Machine
|
||||
vm_created = VirtualMachine.create(
|
||||
self.userapiclient,
|
||||
@ -4188,5 +4284,5 @@ class TestIpAddresses(cloudstackTestCase):
|
||||
# Destroying the VM
|
||||
vm_created.delete(self.userapiclient)
|
||||
vm_created.expung(self.apiClient)
|
||||
self.cleanup.append(self.account)
|
||||
return
|
||||
|
||||
@ -16,41 +16,18 @@
|
||||
# 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)
|
||||
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())
|
||||
@ -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,
|
||||
@ -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,
|
||||
|
||||
@ -16,41 +16,18 @@
|
||||
# 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)
|
||||
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):
|
||||
|
||||
@ -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,9 +759,7 @@ 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"]
|
||||
self.services["templateregister"]["ostype"] = self.services["ostype"]
|
||||
# Listing Hypervisors in Zone 1
|
||||
hypervisor_list = Hypervisor.list(
|
||||
self.apiClient,
|
||||
@ -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
|
||||
@ -740,6 +740,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",
|
||||
|
||||
@ -1547,7 +1547,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()
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user