CLOUDSTACK-6282-Modified IpAddresses, Instances, Templates, Snapshots tests to handle KVM and modified IPAddresses for failed list cases

This commit is contained in:
VinayV 2014-06-12 14:17:31 +05:30 committed by Girish Shilamkar
parent 3a3a3902b7
commit 99e4da15da
6 changed files with 1124 additions and 1066 deletions

View File

@ -15,42 +15,19 @@
# specific language governing permissions and limitations # specific language governing permissions and limitations
# under the License. # under the License.
#Import Local Modules # Import Local Modules
from marvin.cloudstackTestCase import cloudstackTestCase from marvin.cloudstackTestCase import *
from marvin.cloudstackAPI import (createVolume, from marvin.cloudstackException import *
createTemplate) from marvin.cloudstackAPI import *
from marvin.lib.base import (Volume, from marvin.sshClient import SshClient
Iso, from marvin.lib.utils import *
VirtualMachine, from marvin.lib.base import *
Template, from marvin.lib.common import *
Snapshot, from marvin.lib.utils import checkVolumeSize
SecurityGroup, from marvin.codes import SUCCESS
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 nose.plugins.attrib import attr from nose.plugins.attrib import attr
import time from time import sleep
from ctypes.wintypes import BOOLEAN
class TestListInstances(cloudstackTestCase): class TestListInstances(cloudstackTestCase):
@ -61,6 +38,7 @@ class TestListInstances(cloudstackTestCase):
cls.testClient = super(TestListInstances, cls).getClsTestClient() cls.testClient = super(TestListInstances, cls).getClsTestClient()
cls.api_client = cls.testClient.getApiClient() cls.api_client = cls.testClient.getApiClient()
cls.services = cls.testClient.getParsedTestDataConfig() cls.services = cls.testClient.getParsedTestDataConfig()
cls.hypervisor = cls.testClient.getHypervisorInfo()
# Get Domain, Zone, Template # Get Domain, Zone, Template
cls.domain = get_domain(cls.api_client) cls.domain = get_domain(cls.api_client)
cls.zone = get_zone(cls.api_client, cls.testClient.getZoneForTests()) cls.zone = get_zone(cls.api_client, cls.testClient.getZoneForTests())
@ -101,7 +79,7 @@ class TestListInstances(cloudstackTestCase):
cls.user = cls.account.user[0] cls.user = cls.account.user[0]
cls.userapiclient = cls.testClient.getUserApiClient(cls.user.username, cls.domain.name) cls.userapiclient = cls.testClient.getUserApiClient(cls.user.username, cls.domain.name)
# Updating resource Limits # Updating resource Limits
for i in range(0,12): for i in range(0, 12):
Resources.updateLimit( Resources.updateLimit(
cls.api_client, cls.api_client,
account=cls.account.name, account=cls.account.name,
@ -124,7 +102,7 @@ class TestListInstances(cloudstackTestCase):
self.cleanup = [] self.cleanup = []
def tearDown(self): def tearDown(self):
#Clean up, terminate the created resources # Clean up, terminate the created resources
cleanup_resources(self.apiClient, self.cleanup) cleanup_resources(self.apiClient, self.cleanup)
return return
@ -363,7 +341,7 @@ class TestListInstances(cloudstackTestCase):
) )
running_vm = list_running_vms_after[0] running_vm = list_running_vms_after[0]
#Creating expected and actual values dictionaries # Creating expected and actual values dictionaries
expected_dict = { expected_dict = {
"id":vm_created.id, "id":vm_created.id,
"name":vm_created.name, "name":vm_created.name,
@ -456,7 +434,7 @@ class TestListInstances(cloudstackTestCase):
"Stopped VM list count is not matching" "Stopped VM list count is not matching"
) )
stopped_vm = list_stopped_vms_after[0] stopped_vm = list_stopped_vms_after[0]
#Creating expected and actual values dictionaries # Creating expected and actual values dictionaries
expected_dict = { expected_dict = {
"id":vm_created.id, "id":vm_created.id,
"name":vm_created.name, "name":vm_created.name,
@ -564,7 +542,7 @@ class TestListInstances(cloudstackTestCase):
"Destroyed VM list count is not matching" "Destroyed VM list count is not matching"
) )
destroyed_vm = list_destroyed_vms_admin[0] destroyed_vm = list_destroyed_vms_admin[0]
#Creating expected and actual values dictionaries # Creating expected and actual values dictionaries
expected_dict = { expected_dict = {
"id":vm_created.id, "id":vm_created.id,
"name":vm_created.name, "name":vm_created.name,
@ -666,7 +644,7 @@ class TestListInstances(cloudstackTestCase):
"Listing of VM by Id failed" "Listing of VM by Id failed"
) )
listed_vm = list_vm_byid[0] listed_vm = list_vm_byid[0]
#Creating expected and actual values dictionaries # Creating expected and actual values dictionaries
expected_dict = { expected_dict = {
"id":vm_created.id, "id":vm_created.id,
"name":vm_created.name, "name":vm_created.name,
@ -782,7 +760,7 @@ class TestListInstances(cloudstackTestCase):
"VM list by full name count is not matching" "VM list by full name count is not matching"
) )
# Verifying that the details of the listed VM are same as the VM created above # 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 = { expected_dict = {
"id":vms[0].id, "id":vms[0].id,
"name":vms[0].name, "name":vms[0].name,
@ -916,7 +894,7 @@ class TestListInstances(cloudstackTestCase):
"Count of VM list by name and state is not matching" "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 # 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 = { expected_dict = {
"id":vm_created.id, "id":vm_created.id,
"name":vm_created.name, "name":vm_created.name,
@ -1068,7 +1046,7 @@ class TestListInstances(cloudstackTestCase):
) )
listed_vm = list_vms_after[0] listed_vm = list_vms_after[0]
# Verifying that the details of the Listed VM are same as the VM deployed above # 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 = { expected_dict = {
"id":vm_created.id, "id":vm_created.id,
"name":vm_created.name, "name":vm_created.name,
@ -1235,7 +1213,7 @@ class TestListInstances(cloudstackTestCase):
) )
listed_vm = list_vms[0] listed_vm = list_vms[0]
# Verifying that the details of the Listed VM are same as the VM deployed above # 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 = { expected_dict = {
"id":vm_created.id, "id":vm_created.id,
"name":vm_created.name, "name":vm_created.name,
@ -1388,7 +1366,7 @@ class TestListInstances(cloudstackTestCase):
) )
listed_vm = list_vms[0] listed_vm = list_vms[0]
# Verifying that the details of the Listed VM are same as the VM deployed above # 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 = { expected_dict = {
"id":vm_created.id, "id":vm_created.id,
"name":vm_created.name, "name":vm_created.name,
@ -1456,7 +1434,7 @@ class TestListInstances(cloudstackTestCase):
) )
listed_vm = list_vms[0] listed_vm = list_vms[0]
# Verifying that the details of the Listed VM are same as the VM deployed above # 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 = { expected_dict = {
"id":vm_created.id, "id":vm_created.id,
"name":vm_created.name, "name":vm_created.name,
@ -1899,7 +1877,7 @@ class TestInstances(cloudstackTestCase):
cls.testClient = super(TestInstances, cls).getClsTestClient() cls.testClient = super(TestInstances, cls).getClsTestClient()
cls.api_client = cls.testClient.getApiClient() cls.api_client = cls.testClient.getApiClient()
cls.services = cls.testClient.getParsedTestDataConfig() cls.services = cls.testClient.getParsedTestDataConfig()
cls.hypervisor = cls.testClient.getHypervisorInfo()
# Get Domain, Zone, Template # Get Domain, Zone, Template
cls.domain = get_domain(cls.api_client) cls.domain = get_domain(cls.api_client)
cls.zone = get_zone(cls.api_client, cls.testClient.getZoneForTests()) cls.zone = get_zone(cls.api_client, cls.testClient.getZoneForTests())
@ -1941,7 +1919,7 @@ class TestInstances(cloudstackTestCase):
cls.user = cls.account.user[0] cls.user = cls.account.user[0]
cls.userapiclient = cls.testClient.getUserApiClient(cls.user.username, cls.domain.name) cls.userapiclient = cls.testClient.getUserApiClient(cls.user.username, cls.domain.name)
# Updating resource Limits # Updating resource Limits
for i in range(0,12): for i in range(0, 12):
Resources.updateLimit( Resources.updateLimit(
cls.api_client, cls.api_client,
account=cls.account.name, account=cls.account.name,
@ -1963,7 +1941,7 @@ class TestInstances(cloudstackTestCase):
self.cleanup = [] self.cleanup = []
def tearDown(self): def tearDown(self):
#Clean up, terminate the created resources # Clean up, terminate the created resources
cleanup_resources(self.apiClient, self.cleanup) cleanup_resources(self.apiClient, self.cleanup)
return return
@ -2024,6 +2002,8 @@ class TestInstances(cloudstackTestCase):
Step10: Detaching the ISO attached in step8 Step10: Detaching the ISO attached in step8
Step11: Verifying that detached ISO details are not associated with VM 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 # Listing all the VM's for a User
list_vms_before = VirtualMachine.list( list_vms_before = VirtualMachine.list(
self.userapiclient, self.userapiclient,
@ -2154,6 +2134,8 @@ class TestInstances(cloudstackTestCase):
Step12: Listing all the VM snapshots in Page 2 with page size Step12: Listing all the VM snapshots in Page 2 with page size
Step13: Verifying that size of the list is 0 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 # Listing all the VM's for a User
list_vms_before = VirtualMachine.list( list_vms_before = VirtualMachine.list(
self.userapiclient, self.userapiclient,
@ -2309,6 +2291,8 @@ class TestInstances(cloudstackTestCase):
Step10: Verifying that only 1 VM snapshot is having current flag set as true. 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 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 # Listing all the VM's for a User
list_vms_before = VirtualMachine.list( list_vms_before = VirtualMachine.list(
self.userapiclient, self.userapiclient,
@ -2624,6 +2608,32 @@ class TestInstances(cloudstackTestCase):
list_volumes_page2, list_volumes_page2,
"Volumes listed in page 2" "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 return
@attr(tags=["advanced", "basic", "provisioning"]) @attr(tags=["advanced", "basic", "provisioning"])
@ -2641,6 +2651,8 @@ class TestInstances(cloudstackTestCase):
Step5: Perform change service (scale up) the Running VM deployed in step1 Step5: Perform change service (scale up) the Running VM deployed in step1
Step6: Verifying that VM's service offerings is changed 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 # Checking if Dynamic scaling of VM is supported or not
list_config = Configurations.list( list_config = Configurations.list(
self.apiClient, self.apiClient,

File diff suppressed because it is too large Load Diff

View File

@ -15,42 +15,19 @@
# specific language governing permissions and limitations # specific language governing permissions and limitations
# under the License. # under the License.
#Import Local Modules # Import Local Modules
from marvin.cloudstackTestCase import cloudstackTestCase from marvin.cloudstackTestCase import *
from marvin.cloudstackAPI import (createVolume, from marvin.cloudstackException import *
createTemplate) from marvin.cloudstackAPI import *
from marvin.lib.base import (Volume, from marvin.sshClient import SshClient
Iso, from marvin.lib.utils import *
VirtualMachine, from marvin.lib.base import *
Template, from marvin.lib.common import *
Snapshot, from marvin.lib.utils import checkVolumeSize
SecurityGroup, from marvin.codes import SUCCESS
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 nose.plugins.attrib import attr from nose.plugins.attrib import attr
import time from time import sleep
from ctypes.wintypes import BOOLEAN
class TestSnapshots(cloudstackTestCase): class TestSnapshots(cloudstackTestCase):
@ -61,6 +38,7 @@ class TestSnapshots(cloudstackTestCase):
cls.testClient = super(TestSnapshots, cls).getClsTestClient() cls.testClient = super(TestSnapshots, cls).getClsTestClient()
cls.api_client = cls.testClient.getApiClient() cls.api_client = cls.testClient.getApiClient()
cls.services = cls.testClient.getParsedTestDataConfig() cls.services = cls.testClient.getParsedTestDataConfig()
cls.hypervisor = cls.testClient.getHypervisorInfo()
# Get Domain, Zone, Template # Get Domain, Zone, Template
cls.domain = get_domain(cls.api_client) cls.domain = get_domain(cls.api_client)
cls.zone = get_zone(cls.api_client, cls.testClient.getZoneForTests()) cls.zone = get_zone(cls.api_client, cls.testClient.getZoneForTests())
@ -123,7 +101,7 @@ class TestSnapshots(cloudstackTestCase):
self.cleanup = [] self.cleanup = []
def tearDown(self): def tearDown(self):
#Clean up, terminate the created resources # Clean up, terminate the created resources
cleanup_resources(self.apiClient, self.cleanup) cleanup_resources(self.apiClient, self.cleanup)
return return
@ -387,7 +365,7 @@ class TestSnapshots(cloudstackTestCase):
"Size of the list volume snapshot by Id is not matching" "Size of the list volume snapshot by Id is not matching"
) )
# Verifying details of the listed snapshot to be same as snapshot created above # 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 = { expected_dict = {
"id":snapshot_created.id, "id":snapshot_created.id,
"name":snapshot_created.name, "name":snapshot_created.name,
@ -435,6 +413,8 @@ class TestSnapshots(cloudstackTestCase):
Step11: Listing all the volume snapshots in page2 Step11: Listing all the volume snapshots in page2
Step12: Verifying that list size is 0 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 # Listing all the VM snapshots for a User
list_vm_snaps_before = VmSnapshot.list( list_vm_snaps_before = VmSnapshot.list(
self.userapiclient, self.userapiclient,
@ -529,7 +509,7 @@ class TestSnapshots(cloudstackTestCase):
"VM snapshot not deleted from page 2" "VM snapshot not deleted from page 2"
) )
# Deleting all the existing VM snapshots # Deleting all the existing VM snapshots
list_vm_snaps = VmSnapshot.list( list_vm_snaps = VmSnapshot.list(
self.userapiclient, self.userapiclient,
listall=self.services["listall"], listall=self.services["listall"],
) )
@ -567,6 +547,8 @@ class TestSnapshots(cloudstackTestCase):
Step7: Verifying that list size is 1 Step7: Verifying that list size is 1
Step8: Verifying details of the listed VM snapshot 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 # Listing all the VM snapshots for a User
list_vm_snaps_before = VmSnapshot.list( list_vm_snaps_before = VmSnapshot.list(
self.userapiclient, self.userapiclient,
@ -622,7 +604,7 @@ class TestSnapshots(cloudstackTestCase):
"Size of the list vm snapshot by Id is not matching" "Size of the list vm snapshot by Id is not matching"
) )
# Verifying details of the listed snapshot to be same as snapshot created above # 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 = { expected_dict = {
"id":snapshot_created.id, "id":snapshot_created.id,
"name":snapshot_created.name, "name":snapshot_created.name,

View File

@ -15,42 +15,19 @@
# specific language governing permissions and limitations # specific language governing permissions and limitations
# under the License. # under the License.
#Import Local Modules # Import Local Modules
from marvin.cloudstackTestCase import cloudstackTestCase from marvin.cloudstackTestCase import *
from marvin.cloudstackAPI import (createVolume, from marvin.cloudstackException import *
createTemplate) from marvin.cloudstackAPI import *
from marvin.lib.base import (Volume, from marvin.sshClient import SshClient
Iso, from marvin.lib.utils import *
VirtualMachine, from marvin.lib.base import *
Template, from marvin.lib.common import *
Snapshot, from marvin.lib.utils import checkVolumeSize
SecurityGroup, from marvin.codes import SUCCESS
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 nose.plugins.attrib import attr from nose.plugins.attrib import attr
import time from time import sleep
from ctypes.wintypes import BOOLEAN
class TestTemplates(cloudstackTestCase): class TestTemplates(cloudstackTestCase):
@ -91,7 +68,7 @@ class TestTemplates(cloudstackTestCase):
self.cleanup = [] self.cleanup = []
def tearDown(self): def tearDown(self):
#Clean up, terminate the created resources # Clean up, terminate the created resources
cleanup_resources(self.apiClient, self.cleanup) cleanup_resources(self.apiClient, self.cleanup)
return return
@ -168,14 +145,12 @@ class TestTemplates(cloudstackTestCase):
list_templates_before, list_templates_before,
"Templates listed for newly created User" "Templates listed for newly created User"
) )
self.services["template"]["url"] = "http://10.147.28.7/templates/ttylinux_pv.vhd" self.services["templateregister"]["ostype"] = self.services["ostype"]
self.services["template"]["format"] = "VHD"
self.services["template"]["ostype"] = self.services["ostype"]
# Creating pagesize + 1 number of Templates # Creating pagesize + 1 number of Templates
for i in range(0, (self.services["pagesize"] + 1)): for i in range(0, (self.services["pagesize"] + 1)):
template_created = Template.register( template_created = Template.register(
self.userapiclient, self.userapiclient,
self.services["template"], self.services["templateregister"],
self.zone.id, self.zone.id,
hypervisor=self.hypervisor hypervisor=self.hypervisor
) )
@ -290,9 +265,7 @@ class TestTemplates(cloudstackTestCase):
list_templates_page2, list_templates_page2,
"Templates not deleted from page 2" "Templates not deleted from page 2"
) )
del self.services["template"]["url"] del self.services["templateregister"]["ostype"]
del self.services["template"]["format"]
del self.services["template"]["ostype"]
return return
@attr(tags=["advanced", "basic", "provisioning"]) @attr(tags=["advanced", "basic", "provisioning"])
@ -322,14 +295,12 @@ class TestTemplates(cloudstackTestCase):
list_templates_before, list_templates_before,
"Templates listed for newly created User" "Templates listed for newly created User"
) )
self.services["template"]["url"] = "http://10.147.28.7/templates/ttylinux_pv.vhd" self.services["templateregister"]["ostype"] = self.services["ostype"]
self.services["template"]["format"] = "VHD" self.services["templateregister"]["isextractable"] = True
self.services["template"]["ostype"] = self.services["ostype"]
self.services["template"]["isextractable"] = True
# Creating aTemplate # Creating aTemplate
template_created = Template.register( template_created = Template.register(
self.userapiclient, self.userapiclient,
self.services["template"], self.services["templateregister"],
self.zone.id, self.zone.id,
hypervisor=self.hypervisor hypervisor=self.hypervisor
) )
@ -410,10 +381,8 @@ class TestTemplates(cloudstackTestCase):
download_template.id, download_template.id,
"Download Template details are not same as Template created" "Download Template details are not same as Template created"
) )
del self.services["template"]["url"] del self.services["templateregister"]["ostype"]
del self.services["template"]["format"] del self.services["templateregister"]["isextractable"]
del self.services["template"]["ostype"]
del self.services["template"]["isextractable"]
return return
@attr(tags=["advanced", "basic", "provisioning"]) @attr(tags=["advanced", "basic", "provisioning"])
@ -451,13 +420,11 @@ class TestTemplates(cloudstackTestCase):
list_templates_before, list_templates_before,
"Templates listed for newly created User" "Templates listed for newly created User"
) )
self.services["template"]["url"] = "http://10.147.28.7/templates/ttylinux_pv.vhd" self.services["templateregister"]["ostype"] = self.services["ostype"]
self.services["template"]["format"] = "VHD"
self.services["template"]["ostype"] = self.services["ostype"]
# Creating aTemplate # Creating aTemplate
template_created = Template.register( template_created = Template.register(
self.userapiclient, self.userapiclient,
self.services["template"], self.services["templateregister"],
self.zone.id, self.zone.id,
hypervisor=self.hypervisor hypervisor=self.hypervisor
) )
@ -727,9 +694,7 @@ class TestTemplates(cloudstackTestCase):
edit_template_status, edit_template_status,
"Edited Template details are not as expected" "Edited Template details are not as expected"
) )
del self.services["template"]["url"] del self.services["templateregister"]["ostype"]
del self.services["template"]["format"]
del self.services["template"]["ostype"]
return return
@attr(tags=["advanced", "basic", "provisioning"]) @attr(tags=["advanced", "basic", "provisioning"])
@ -768,7 +733,7 @@ class TestTemplates(cloudstackTestCase):
"Failed to list Zones" "Failed to list Zones"
) )
if not len(zones_list) > 1: 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: else:
# Listing all the Templates for a User in Zone 1 # Listing all the Templates for a User in Zone 1
list_templates_zone1 = Template.list( list_templates_zone1 = Template.list(
@ -794,10 +759,8 @@ class TestTemplates(cloudstackTestCase):
list_templates_zone2, list_templates_zone2,
"Templates listed for newly created User in Zone2" "Templates listed for newly created User in Zone2"
) )
self.services["template"]["url"] = "http://10.147.28.7/templates/ttylinux_pv.vhd" self.services["templateregister"]["ostype"] = self.services["ostype"]
self.services["template"]["format"] = "VHD" # Listing Hypervisors in Zone 1
self.services["template"]["ostype"] = self.services["ostype"]
#Listing Hypervisors in Zone 1
hypervisor_list = Hypervisor.list( hypervisor_list = Hypervisor.list(
self.apiClient, self.apiClient,
zoneid=zones_list[0].id zoneid=zones_list[0].id
@ -811,7 +774,7 @@ class TestTemplates(cloudstackTestCase):
# Creating aTemplate in Zone 1 # Creating aTemplate in Zone 1
template_created = Template.register( template_created = Template.register(
self.userapiclient, self.userapiclient,
self.services["template"], self.services["templateregister"],
zones_list[0].id, zones_list[0].id,
hypervisor=hypervisor_list[0].name hypervisor=hypervisor_list[0].name
) )
@ -938,7 +901,5 @@ class TestTemplates(cloudstackTestCase):
list_templates_zone2[0].isready, list_templates_zone2[0].isready,
"Failed to copy Template" "Failed to copy Template"
) )
del self.services["template"]["url"] del self.services["templateregister"]["ostype"]
del self.services["template"]["format"]
del self.services["template"]["ostype"]
return return

View File

@ -740,6 +740,13 @@ test_data = {
"ostype": "CentOS 5.3 (64-bit)", "ostype": "CentOS 5.3 (64-bit)",
"templatefilter": 'self', "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"}, "security_group": {"name": "custom_Sec_Grp"},
"ingress_rule": { "ingress_rule": {
"protocol": "TCP", "protocol": "TCP",

View File

@ -1547,7 +1547,7 @@ class StaticNATRule:
return return
@classmethod @classmethod
def disable(cls, apiclient, ipaddressid, virtualmachineid): def disable(cls, apiclient, ipaddressid, virtualmachineid=None):
"""Disables Static NAT rule""" """Disables Static NAT rule"""
cmd = disableStaticNat.disableStaticNatCmd() cmd = disableStaticNat.disableStaticNatCmd()