mirror of
				https://github.com/apache/cloudstack.git
				synced 2025-10-26 08:42:29 +01:00 
			
		
		
		
	Summary: Removing ostypeid dependencies from tests
Detail: The listOsTypes API will filter when given the ostype name as centOS 5.3. There is now no need to hardcode the uuids into the test Signed-off-by: Prasanna Santhanam <tsp@apache.org> 1354228309 -0800
This commit is contained in:
		
							parent
							
								
									6036f73725
								
							
						
					
					
						commit
						2c561dd3a8
					
				| @ -105,7 +105,7 @@ class Services: | |||||||
|                         "templates": { |                         "templates": { | ||||||
|                                     "displaytext": 'Template', |                                     "displaytext": 'Template', | ||||||
|                                     "name": 'Template', |                                     "name": 'Template', | ||||||
|                                     "ostypeid": '01853327-513e-4508-9628-f1f55db1946f', |                                     "ostype": "CentOS 5.3 (64-bit)", | ||||||
|                                     "templatefilter": 'self', |                                     "templatefilter": 'self', | ||||||
|                                 }, |                                 }, | ||||||
|                         "diskdevice": "/dev/xvda", |                         "diskdevice": "/dev/xvda", | ||||||
| @ -117,8 +117,7 @@ class Services: | |||||||
|                         "sub_lvl_dir1": "test1", |                         "sub_lvl_dir1": "test1", | ||||||
|                         "sub_lvl_dir2": "test2", |                         "sub_lvl_dir2": "test2", | ||||||
|                         "random_data": "random.data", |                         "random_data": "random.data", | ||||||
| 
 |                         "ostype": "CentOS 5.3 (64-bit)", | ||||||
|                         "ostypeid": '01853327-513e-4508-9628-f1f55db1946f', |  | ||||||
|                         # Cent OS 5.3 (64 bit) |                         # Cent OS 5.3 (64 bit) | ||||||
|                         "sleep": 60, |                         "sleep": 60, | ||||||
|                         "timeout": 10, |                         "timeout": 10, | ||||||
| @ -139,11 +138,11 @@ class TestSnapshotRootDisk(cloudstackTestCase): | |||||||
|         template = get_template( |         template = get_template( | ||||||
|                             cls.api_client, |                             cls.api_client, | ||||||
|                             cls.zone.id, |                             cls.zone.id, | ||||||
|                             cls.services["ostypeid"] |                             cls.services["ostype"] | ||||||
|                             ) |                             ) | ||||||
|         cls.services["domainid"] = cls.domain.id |         cls.services["domainid"] = cls.domain.id | ||||||
|         cls.services["server_without_disk"]["zoneid"] = cls.zone.id |         cls.services["server_without_disk"]["zoneid"] = cls.zone.id | ||||||
|         cls.services["template"] = template.id |         cls.services["templates"]["ostypeid"] = template.ostypeid | ||||||
|         cls.services["zoneid"] = cls.zone.id |         cls.services["zoneid"] = cls.zone.id | ||||||
| 
 | 
 | ||||||
|         # Create VMs, NAT Rules etc |         # Create VMs, NAT Rules etc | ||||||
| @ -364,7 +363,7 @@ class TestSnapshots(cloudstackTestCase): | |||||||
|         template = get_template( |         template = get_template( | ||||||
|                             cls.api_client, |                             cls.api_client, | ||||||
|                             cls.zone.id, |                             cls.zone.id, | ||||||
|                             cls.services["ostypeid"] |                             cls.services["ostype"] | ||||||
|                             ) |                             ) | ||||||
|          |          | ||||||
|         cls.services["domainid"] = cls.domain.id |         cls.services["domainid"] = cls.domain.id | ||||||
| @ -373,7 +372,7 @@ class TestSnapshots(cloudstackTestCase): | |||||||
| 
 | 
 | ||||||
|         cls.services["server_without_disk"]["zoneid"] = cls.zone.id |         cls.services["server_without_disk"]["zoneid"] = cls.zone.id | ||||||
| 
 | 
 | ||||||
|         cls.services["template"] = template.id |         cls.services["templates"]["ostypeid"] = template.ostypeid | ||||||
|         cls.services["zoneid"] = cls.zone.id |         cls.services["zoneid"] = cls.zone.id | ||||||
|         cls.services["diskoffering"] = cls.disk_offering.id |         cls.services["diskoffering"] = cls.disk_offering.id | ||||||
| 
 | 
 | ||||||
| @ -1195,12 +1194,11 @@ class TestCreateVMsnapshotTemplate(cloudstackTestCase): | |||||||
|         cls.template = get_template( |         cls.template = get_template( | ||||||
|                             cls.api_client, |                             cls.api_client, | ||||||
|                             cls.zone.id, |                             cls.zone.id, | ||||||
|                             cls.services["ostypeid"] |                             cls.services["ostype"] | ||||||
|                             ) |                             ) | ||||||
|         cls.services["domainid"] = cls.domain.id |         cls.services["domainid"] = cls.domain.id | ||||||
|         cls.services["server"]["zoneid"] = cls.zone.id |         cls.services["server"]["zoneid"] = cls.zone.id | ||||||
| 
 | 
 | ||||||
|         cls.services["template"] = cls.template.id |  | ||||||
| 
 | 
 | ||||||
|         # Create VMs, NAT Rules etc |         # Create VMs, NAT Rules etc | ||||||
|         cls.account = Account.create( |         cls.account = Account.create( | ||||||
| @ -1491,7 +1489,7 @@ class TestAccountSnapshotClean(cloudstackTestCase): | |||||||
|         template = get_template( |         template = get_template( | ||||||
|                             cls.api_client, |                             cls.api_client, | ||||||
|                             cls.zone.id, |                             cls.zone.id, | ||||||
|                             cls.services["ostypeid"] |                             cls.services["ostype"] | ||||||
|                             ) |                             ) | ||||||
|         cls.services["server"]["zoneid"] = cls.zone.id |         cls.services["server"]["zoneid"] = cls.zone.id | ||||||
| 
 | 
 | ||||||
| @ -1843,7 +1841,7 @@ class TestSnapshotDetachedDisk(cloudstackTestCase): | |||||||
|         template = get_template( |         template = get_template( | ||||||
|                             cls.api_client, |                             cls.api_client, | ||||||
|                             cls.zone.id, |                             cls.zone.id, | ||||||
|                             cls.services["ostypeid"] |                             cls.services["ostype"] | ||||||
|                             ) |                             ) | ||||||
|         cls.services["server"]["zoneid"] = cls.zone.id |         cls.services["server"]["zoneid"] = cls.zone.id | ||||||
|         cls.services["server"]["diskoffering"] = cls.disk_offering.id |         cls.services["server"]["diskoffering"] = cls.disk_offering.id | ||||||
| @ -2126,7 +2124,7 @@ class TestSnapshotLimit(cloudstackTestCase): | |||||||
|         template = get_template( |         template = get_template( | ||||||
|                             cls.api_client, |                             cls.api_client, | ||||||
|                             cls.zone.id, |                             cls.zone.id, | ||||||
|                             cls.services["ostypeid"] |                             cls.services["ostype"] | ||||||
|                             ) |                             ) | ||||||
|         cls.services["server"]["zoneid"] = cls.zone.id |         cls.services["server"]["zoneid"] = cls.zone.id | ||||||
| 
 | 
 | ||||||
| @ -2384,7 +2382,7 @@ class TestSnapshotEvents(cloudstackTestCase): | |||||||
|         template = get_template( |         template = get_template( | ||||||
|                             cls.api_client, |                             cls.api_client, | ||||||
|                             cls.zone.id, |                             cls.zone.id, | ||||||
|                             cls.services["ostypeid"] |                             cls.services["ostype"] | ||||||
|                             ) |                             ) | ||||||
|         cls.services["server"]["zoneid"] = cls.zone.id |         cls.services["server"]["zoneid"] = cls.zone.id | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -55,7 +55,7 @@ class Services: | |||||||
|                         "isextractable": True, |                         "isextractable": True, | ||||||
|                         "isfeatured": True, |                         "isfeatured": True, | ||||||
|                         "ispublic": True, |                         "ispublic": True, | ||||||
|                         "ostypeid": '01853327-513e-4508-9628-f1f55db1946f', |                         "ostype": "CentOS 5.3 (64-bit)", | ||||||
|                     }, |                     }, | ||||||
|             "iso_2": |             "iso_2": | ||||||
|                     { |                     { | ||||||
| @ -66,7 +66,7 @@ class Services: | |||||||
|                         "isextractable": True, |                         "isextractable": True, | ||||||
|                         "isfeatured": True, |                         "isfeatured": True, | ||||||
|                         "ispublic": True, |                         "ispublic": True, | ||||||
|                         "ostypeid": '01853327-513e-4508-9628-f1f55db1946f', |                         "ostype": "CentOS 5.3 (64-bit)", | ||||||
|                         "mode": 'HTTP_DOWNLOAD', |                         "mode": 'HTTP_DOWNLOAD', | ||||||
|                         # Used in Extract template, value must be HTTP_DOWNLOAD |                         # Used in Extract template, value must be HTTP_DOWNLOAD | ||||||
|                     }, |                     }, | ||||||
| @ -79,7 +79,7 @@ class Services: | |||||||
|             "passwordenabled": True, |             "passwordenabled": True, | ||||||
|             "sleep": 60, |             "sleep": 60, | ||||||
|             "timeout": 10, |             "timeout": 10, | ||||||
|             "ostypeid": '01853327-513e-4508-9628-f1f55db1946f', |             "ostype": "CentOS 5.3 (64-bit)", | ||||||
|             # CentOS 5.3 (64 bit) |             # CentOS 5.3 (64 bit) | ||||||
|             "mode": 'advanced' |             "mode": 'advanced' | ||||||
|             # Networking mode: Basic or Advanced |             # Networking mode: Basic or Advanced | ||||||
| @ -103,6 +103,17 @@ class TestCreateIso(cloudstackTestCase): | |||||||
|                             self.services["account"], |                             self.services["account"], | ||||||
|                             domainid=self.domain.id |                             domainid=self.domain.id | ||||||
|                             ) |                             ) | ||||||
|  |         # Finding the OsTypeId from Ostype | ||||||
|  |         ostypes = list_os_types( | ||||||
|  |                     self.apiclient, | ||||||
|  |                     description=self.services["ostype"] | ||||||
|  |                     ) | ||||||
|  |         if not isinstance(ostypes, list): | ||||||
|  |             raise unittest.SkipTest("OSTypeId for given description not found") | ||||||
|  | 
 | ||||||
|  |         self.services["iso_1"]["ostypeid"] = ostypes[0].id | ||||||
|  |         self.services["iso_2"]["ostypeid"] = ostypes[0].id | ||||||
|  |         self.services["ostypeid"] = ostypes[0].id | ||||||
| 
 | 
 | ||||||
|         self.cleanup = [self.account] |         self.cleanup = [self.account] | ||||||
|         return |         return | ||||||
| @ -200,6 +211,18 @@ class TestISO(cloudstackTestCase): | |||||||
|                             domainid=cls.domain.id |                             domainid=cls.domain.id | ||||||
|                             ) |                             ) | ||||||
|         cls.services["account"] = cls.account.account.name |         cls.services["account"] = cls.account.account.name | ||||||
|  |         # Finding the OsTypeId from Ostype | ||||||
|  |         ostypes = list_os_types( | ||||||
|  |                     self.apiclient, | ||||||
|  |                     description=self.services["ostype"] | ||||||
|  |                     ) | ||||||
|  |         if not isinstance(ostypes, list): | ||||||
|  |             raise unittest.SkipTest("OSTypeId for given description not found") | ||||||
|  | 
 | ||||||
|  |         self.services["iso_1"]["ostypeid"] = ostypes[0].id | ||||||
|  |         self.services["iso_2"]["ostypeid"] = ostypes[0].id | ||||||
|  |         self.services["ostypeid"] = ostypes[0].id | ||||||
|  | 
 | ||||||
|         cls.iso_1 = Iso.create( |         cls.iso_1 = Iso.create( | ||||||
|                                cls.api_client,  |                                cls.api_client,  | ||||||
|                                cls.services["iso_1"], |                                cls.services["iso_1"], | ||||||
|  | |||||||
| @ -36,7 +36,7 @@ class Services: | |||||||
| 
 | 
 | ||||||
|     def __init__(self): |     def __init__(self): | ||||||
|         self.services = { |         self.services = { | ||||||
|                             "ostypeid": '01853327-513e-4508-9628-f1f55db1946f', |                             "ostype": "CentOS 5.3 (64-bit)", | ||||||
|                             # Cent OS 5.3 (64 bit) |                             # Cent OS 5.3 (64 bit) | ||||||
|                             "mode": 'advanced', |                             "mode": 'advanced', | ||||||
|                             # Networking mode: Basic or advanced |                             # Networking mode: Basic or advanced | ||||||
| @ -305,7 +305,7 @@ class TestPortForwarding(cloudstackTestCase): | |||||||
|         template = get_template( |         template = get_template( | ||||||
|                             cls.api_client, |                             cls.api_client, | ||||||
|                             cls.zone.id, |                             cls.zone.id, | ||||||
|                             cls.services["ostypeid"] |                             cls.services["ostype"] | ||||||
|                             ) |                             ) | ||||||
|         #Create an account, network, VM and IP addresses |         #Create an account, network, VM and IP addresses | ||||||
|         cls.account = Account.create( |         cls.account = Account.create( | ||||||
| @ -604,7 +604,7 @@ class TestLoadBalancingRule(cloudstackTestCase): | |||||||
|         template = get_template( |         template = get_template( | ||||||
|                             cls.api_client, |                             cls.api_client, | ||||||
|                             cls.zone.id, |                             cls.zone.id, | ||||||
|                             cls.services["ostypeid"] |                             cls.services["ostype"] | ||||||
|                             ) |                             ) | ||||||
|         cls.services["server"]["zoneid"] = cls.zone.id |         cls.services["server"]["zoneid"] = cls.zone.id | ||||||
| 
 | 
 | ||||||
| @ -1076,7 +1076,7 @@ class TestRebootRouter(cloudstackTestCase): | |||||||
|         template = get_template( |         template = get_template( | ||||||
|                             self.apiclient, |                             self.apiclient, | ||||||
|                             self.zone.id, |                             self.zone.id, | ||||||
|                             self.services["ostypeid"] |                             self.services["ostype"] | ||||||
|                             ) |                             ) | ||||||
|         self.services["server"]["zoneid"] = self.zone.id |         self.services["server"]["zoneid"] = self.zone.id | ||||||
| 
 | 
 | ||||||
| @ -1236,7 +1236,7 @@ class TestAssignRemoveLB(cloudstackTestCase): | |||||||
|         template = get_template( |         template = get_template( | ||||||
|                             self.apiclient, |                             self.apiclient, | ||||||
|                             self.zone.id, |                             self.zone.id, | ||||||
|                             self.services["ostypeid"] |                             self.services["ostype"] | ||||||
|                             ) |                             ) | ||||||
|         self.services["server"]["zoneid"] = self.zone.id |         self.services["server"]["zoneid"] = self.zone.id | ||||||
| 
 | 
 | ||||||
| @ -1495,7 +1495,7 @@ class TestReleaseIP(cloudstackTestCase): | |||||||
|         template = get_template( |         template = get_template( | ||||||
|                             self.apiclient, |                             self.apiclient, | ||||||
|                             self.zone.id, |                             self.zone.id, | ||||||
|                             self.services["ostypeid"] |                             self.services["ostype"] | ||||||
|                             ) |                             ) | ||||||
|         self.services["server"]["zoneid"] = self.zone.id |         self.services["server"]["zoneid"] = self.zone.id | ||||||
| 
 | 
 | ||||||
| @ -1635,7 +1635,7 @@ class TestDeleteAccount(cloudstackTestCase): | |||||||
|         template = get_template( |         template = get_template( | ||||||
|                             self.apiclient, |                             self.apiclient, | ||||||
|                             self.zone.id, |                             self.zone.id, | ||||||
|                             self.services["ostypeid"] |                             self.services["ostype"] | ||||||
|                             ) |                             ) | ||||||
|         self.services["server"]["zoneid"] = self.zone.id |         self.services["server"]["zoneid"] = self.zone.id | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -61,7 +61,7 @@ class Services: | |||||||
|                                         "username": "testuser", |                                         "username": "testuser", | ||||||
|                                         "password": "password", |                                         "password": "password", | ||||||
|                                         }, |                                         }, | ||||||
|                          "ostypeid":'01853327-513e-4508-9628-f1f55db1946f', |                          "ostype": "CentOS 5.3 (64-bit)", | ||||||
|                          "sleep": 60, |                          "sleep": 60, | ||||||
|                          "timeout": 10, |                          "timeout": 10, | ||||||
|                          "mode": 'advanced', #Networking mode: Basic, Advanced |                          "mode": 'advanced', #Networking mode: Basic, Advanced | ||||||
| @ -84,7 +84,7 @@ class TestRouterServices(cloudstackTestCase): | |||||||
|         template = get_template( |         template = get_template( | ||||||
|                             cls.api_client, |                             cls.api_client, | ||||||
|                             cls.zone.id, |                             cls.zone.id, | ||||||
|                             cls.services["ostypeid"] |                             cls.services["ostype"] | ||||||
|                             ) |                             ) | ||||||
|         cls.services["virtual_machine"]["zoneid"] = cls.zone.id |         cls.services["virtual_machine"]["zoneid"] = cls.zone.id | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -75,12 +75,12 @@ class Services: | |||||||
|                          "template_1": { |                          "template_1": { | ||||||
|                                 "displaytext": "Cent OS Template", |                                 "displaytext": "Cent OS Template", | ||||||
|                                 "name": "Cent OS Template", |                                 "name": "Cent OS Template", | ||||||
|                                 "ostypeid": '01853327-513e-4508-9628-f1f55db1946f', |                                 "ostype": "CentOS 5.3 (64-bit)", | ||||||
|                          }, |                          }, | ||||||
|                          "template_2": { |                          "template_2": { | ||||||
|                                 "displaytext": "Public Template", |                                 "displaytext": "Public Template", | ||||||
|                                 "name": "Public template", |                                 "name": "Public template", | ||||||
|                                 "ostypeid": '01853327-513e-4508-9628-f1f55db1946f', |                                 "ostype": "CentOS 5.3 (64-bit)", | ||||||
|                                 "isfeatured": True, |                                 "isfeatured": True, | ||||||
|                                 "ispublic": True, |                                 "ispublic": True, | ||||||
|                                 "isextractable": True, |                                 "isextractable": True, | ||||||
| @ -94,7 +94,7 @@ class Services: | |||||||
|                         "isextractable": False, |                         "isextractable": False, | ||||||
|                         "bootable": True, |                         "bootable": True, | ||||||
|                         "passwordenabled": True, |                         "passwordenabled": True, | ||||||
|                         "ostypeid": '01853327-513e-4508-9628-f1f55db1946f', |                         "ostype": "CentOS 5.3 (64-bit)", | ||||||
|                         "mode": 'advanced', |                         "mode": 'advanced', | ||||||
|                         # Networking mode: Advanced, basic |                         # Networking mode: Advanced, basic | ||||||
|                         "sleep": 30, |                         "sleep": 30, | ||||||
| @ -135,8 +135,12 @@ class TestCreateTemplate(cloudstackTestCase): | |||||||
|         template = get_template( |         template = get_template( | ||||||
|                             cls.api_client, |                             cls.api_client, | ||||||
|                             cls.zone.id, |                             cls.zone.id, | ||||||
|                             cls.services["ostypeid"] |                             cls.services["ostype"] | ||||||
|                             ) |                             ) | ||||||
|  |         cls.services["template_1"]["ostypeid"] = template.ostypeid | ||||||
|  |         cls.services["template_2"]["ostypeid"] = template.ostypeid | ||||||
|  |         cls.services["ostypeid"] = template.ostypeid | ||||||
|  | 
 | ||||||
|         cls.services["virtual_machine"]["zoneid"] = cls.zone.id |         cls.services["virtual_machine"]["zoneid"] = cls.zone.id | ||||||
|         cls.services["volume"]["diskoffering"] = cls.disk_offering.id |         cls.services["volume"]["diskoffering"] = cls.disk_offering.id | ||||||
|         cls.services["volume"]["zoneid"] = cls.zone.id |         cls.services["volume"]["zoneid"] = cls.zone.id | ||||||
| @ -298,7 +302,7 @@ class TestTemplates(cloudstackTestCase): | |||||||
|         template = get_template( |         template = get_template( | ||||||
|                             cls.api_client, |                             cls.api_client, | ||||||
|                             cls.zone.id, |                             cls.zone.id, | ||||||
|                             cls.services["ostypeid"] |                             cls.services["ostype"] | ||||||
|                             ) |                             ) | ||||||
|         cls.services["virtual_machine"]["zoneid"] = cls.zone.id |         cls.services["virtual_machine"]["zoneid"] = cls.zone.id | ||||||
|         cls.services["volume"]["diskoffering"] = cls.disk_offering.id |         cls.services["volume"]["diskoffering"] = cls.disk_offering.id | ||||||
| @ -306,6 +310,10 @@ class TestTemplates(cloudstackTestCase): | |||||||
|         cls.services["template_2"]["zoneid"] = cls.zone.id |         cls.services["template_2"]["zoneid"] = cls.zone.id | ||||||
|         cls.services["sourcezoneid"] = cls.zone.id |         cls.services["sourcezoneid"] = cls.zone.id | ||||||
| 
 | 
 | ||||||
|  |         cls.services["template_1"]["ostypeid"] = template.ostypeid | ||||||
|  |         cls.services["template_2"]["ostypeid"] = template.ostypeid | ||||||
|  |         cls.services["ostypeid"] = template.ostypeid | ||||||
|  | 
 | ||||||
|         cls.account = Account.create( |         cls.account = Account.create( | ||||||
|                             cls.api_client, |                             cls.api_client, | ||||||
|                             cls.services["account"], |                             cls.services["account"], | ||||||
|  | |||||||
| @ -109,7 +109,7 @@ class Services: | |||||||
|                     "name": "testISO", |                     "name": "testISO", | ||||||
|                     "url": "http://iso.linuxquestions.org/download/504/1819/http/gd4.tuwien.ac.at/dsl-4.4.10.iso", |                     "url": "http://iso.linuxquestions.org/download/504/1819/http/gd4.tuwien.ac.at/dsl-4.4.10.iso", | ||||||
|                      # Source URL where ISO is located |                      # Source URL where ISO is located | ||||||
|                     "ostypeid": '01853327-513e-4508-9628-f1f55db1946f', |                     "ostype": 'CentOS 5.3 (64-bit)', | ||||||
|                     "mode": 'HTTP_DOWNLOAD', # Downloading existing ISO  |                     "mode": 'HTTP_DOWNLOAD', # Downloading existing ISO  | ||||||
|                 }, |                 }, | ||||||
|                 "template": { |                 "template": { | ||||||
| @ -123,7 +123,7 @@ class Services: | |||||||
|             "sleep": 60, |             "sleep": 60, | ||||||
|             "timeout": 10, |             "timeout": 10, | ||||||
|             #Migrate VM to hostid |             #Migrate VM to hostid | ||||||
|             "ostypeid": '01853327-513e-4508-9628-f1f55db1946f', |             "ostype": 'CentOS 5.3 (64-bit)', | ||||||
|             # CentOS 5.3 (64-bit) |             # CentOS 5.3 (64-bit) | ||||||
|             "mode":'advanced', |             "mode":'advanced', | ||||||
|         } |         } | ||||||
| @ -143,7 +143,7 @@ class TestDeployVM(cloudstackTestCase): | |||||||
|         template = get_template( |         template = get_template( | ||||||
|                             self.apiclient, |                             self.apiclient, | ||||||
|                             zone.id, |                             zone.id, | ||||||
|                             self.services["ostypeid"] |                             self.services["ostype"] | ||||||
|                             ) |                             ) | ||||||
|         # Set Zones and disk offerings |         # Set Zones and disk offerings | ||||||
|         self.services["small"]["zoneid"] = zone.id |         self.services["small"]["zoneid"] = zone.id | ||||||
| @ -245,7 +245,7 @@ class TestVMLifeCycle(cloudstackTestCase): | |||||||
|         template = get_template( |         template = get_template( | ||||||
|                             cls.api_client, |                             cls.api_client, | ||||||
|                             zone.id, |                             zone.id, | ||||||
|                             cls.services["ostypeid"] |                             cls.services["ostype"] | ||||||
|                             ) |                             ) | ||||||
|         # Set Zones and disk offerings |         # Set Zones and disk offerings | ||||||
|         cls.services["small"]["zoneid"] = zone.id |         cls.services["small"]["zoneid"] = zone.id | ||||||
| @ -999,7 +999,7 @@ class TestVMPasswordEnabled(cloudstackTestCase): | |||||||
|         template = get_template( |         template = get_template( | ||||||
|                             cls.api_client, |                             cls.api_client, | ||||||
|                             zone.id, |                             zone.id, | ||||||
|                             cls.services["ostypeid"] |                             cls.services["ostype"] | ||||||
|                             ) |                             ) | ||||||
|         # Set Zones and disk offerings |         # Set Zones and disk offerings | ||||||
|         cls.services["small"]["zoneid"] = zone.id |         cls.services["small"]["zoneid"] = zone.id | ||||||
| @ -1065,7 +1065,7 @@ class TestVMPasswordEnabled(cloudstackTestCase): | |||||||
|                 "Exception: Unable to find root volume foe VM: %s" % |                 "Exception: Unable to find root volume foe VM: %s" % | ||||||
|                                                     cls.virtual_machine.id) |                                                     cls.virtual_machine.id) | ||||||
| 
 | 
 | ||||||
|         cls.services["template"]["ostypeid"] = cls.services["ostypeid"] |         cls.services["template"]["ostype"] = cls.services["ostype"] | ||||||
|         #Create templates for Edit, Delete & update permissions testcases |         #Create templates for Edit, Delete & update permissions testcases | ||||||
|         cls.pw_enabled_template = Template.create( |         cls.pw_enabled_template = Template.create( | ||||||
|                                          cls.api_client, |                                          cls.api_client, | ||||||
|  | |||||||
| @ -75,8 +75,8 @@ class Services: | |||||||
|                         "publicport": 22, |                         "publicport": 22, | ||||||
|                         "protocol": 'TCP', |                         "protocol": 'TCP', | ||||||
|                         "diskdevice": "/dev/xvdb", |                         "diskdevice": "/dev/xvdb", | ||||||
|                         "ostypeid": '01853327-513e-4508-9628-f1f55db1946f', |                         "ostype": 'CentOS 5.3 (64-bit)', | ||||||
|                         "mode": 'advanced', |                         "mode": 'basic', | ||||||
|                         "sleep": 60, |                         "sleep": 60, | ||||||
|                         "timeout": 10, |                         "timeout": 10, | ||||||
|                     } |                     } | ||||||
| @ -104,7 +104,7 @@ class TestCreateVolume(cloudstackTestCase): | |||||||
|         template = get_template( |         template = get_template( | ||||||
|                             cls.api_client, |                             cls.api_client, | ||||||
|                             cls.zone.id, |                             cls.zone.id, | ||||||
|                             cls.services["ostypeid"] |                             cls.services["ostype"] | ||||||
|                             ) |                             ) | ||||||
|         cls.services["domainid"] = cls.domain.id |         cls.services["domainid"] = cls.domain.id | ||||||
|         cls.services["zoneid"] = cls.zone.id |         cls.services["zoneid"] = cls.zone.id | ||||||
| @ -286,7 +286,7 @@ class TestVolumes(cloudstackTestCase): | |||||||
|         template = get_template( |         template = get_template( | ||||||
|                             cls.api_client, |                             cls.api_client, | ||||||
|                             cls.zone.id, |                             cls.zone.id, | ||||||
|                             cls.services["ostypeid"] |                             cls.services["ostype"] | ||||||
|                             ) |                             ) | ||||||
|         cls.services["domainid"] = cls.domain.id |         cls.services["domainid"] = cls.domain.id | ||||||
|         cls.services["zoneid"] = cls.zone.id |         cls.services["zoneid"] = cls.zone.id | ||||||
|  | |||||||
| @ -547,7 +547,22 @@ class Template: | |||||||
|         cmd = createTemplate.createTemplateCmd() |         cmd = createTemplate.createTemplateCmd() | ||||||
|         cmd.displaytext = services["displaytext"] |         cmd.displaytext = services["displaytext"] | ||||||
|         cmd.name = "-".join([services["name"], random_gen()]) |         cmd.name = "-".join([services["name"], random_gen()]) | ||||||
|         cmd.ostypeid = services["ostypeid"] |         if "ostypeid" in services: | ||||||
|  |             cmd.ostypeid = services["ostypeid"] | ||||||
|  |         elif "ostype" in services: | ||||||
|  |             # Find OSTypeId from Os type | ||||||
|  |             sub_cmd = listOsTypes.listOsTypesCmd() | ||||||
|  |             sub_cmd.description = services["ostype"] | ||||||
|  |             ostypes = apiclient.listOsTypes(sub_cmd) | ||||||
|  | 
 | ||||||
|  |             if not isinstance(ostypes, list): | ||||||
|  |                 raise Exception( | ||||||
|  |                     "Unable to find Ostype id with desc: %s" % | ||||||
|  |                                                 services["ostype"]) | ||||||
|  |             cmd.ostypeid = ostypes[0].id | ||||||
|  |         else: | ||||||
|  |             raise Exception( | ||||||
|  |                     "Unable to find Ostype is required for creating template") | ||||||
| 
 | 
 | ||||||
|         cmd.isfeatured = services["isfeatured"] if "isfeatured" in services else False |         cmd.isfeatured = services["isfeatured"] if "isfeatured" in services else False | ||||||
|         cmd.ispublic = services["ispublic"] if "ispublic" in services else False |         cmd.ispublic = services["ispublic"] if "ispublic" in services else False | ||||||
| @ -579,7 +594,24 @@ class Template: | |||||||
|         cmd.name = "-".join([services["name"], random_gen()]) |         cmd.name = "-".join([services["name"], random_gen()]) | ||||||
|         cmd.format = services["format"] |         cmd.format = services["format"] | ||||||
|         cmd.hypervisor = services["hypervisor"] |         cmd.hypervisor = services["hypervisor"] | ||||||
|         cmd.ostypeid = services["ostypeid"] | 
 | ||||||
|  |         if "ostypeid" in services: | ||||||
|  |             cmd.ostypeid = services["ostypeid"] | ||||||
|  |         elif "ostype" in services: | ||||||
|  |             # Find OSTypeId from Os type | ||||||
|  |             sub_cmd = listOsTypes.listOsTypesCmd() | ||||||
|  |             sub_cmd.description = services["ostype"] | ||||||
|  |             ostypes = apiclient.listOsTypes(sub_cmd) | ||||||
|  | 
 | ||||||
|  |             if not isinstance(ostypes, list): | ||||||
|  |                 raise Exception( | ||||||
|  |                     "Unable to find Ostype id with desc: %s" % | ||||||
|  |                                                 services["ostype"]) | ||||||
|  |             cmd.ostypeid = ostypes[0].id | ||||||
|  |         else: | ||||||
|  |             raise Exception( | ||||||
|  |                     "Unable to find Ostype is required for registering template") | ||||||
|  | 
 | ||||||
|         cmd.url = services["url"] |         cmd.url = services["url"] | ||||||
| 
 | 
 | ||||||
|         if zoneid: |         if zoneid: | ||||||
| @ -615,7 +647,24 @@ class Template: | |||||||
|                              services["name"], |                              services["name"], | ||||||
|                              random_gen() |                              random_gen() | ||||||
|                             ]) if random_name else services["name"] |                             ]) if random_name else services["name"] | ||||||
|         cmd.ostypeid = services["ostypeid"] | 
 | ||||||
|  |         if "ostypeid" in services: | ||||||
|  |             cmd.ostypeid = services["ostypeid"] | ||||||
|  |         elif "ostype" in services: | ||||||
|  |             # Find OSTypeId from Os type | ||||||
|  |             sub_cmd = listOsTypes.listOsTypesCmd() | ||||||
|  |             sub_cmd.description = services["ostype"] | ||||||
|  |             ostypes = apiclient.listOsTypes(sub_cmd) | ||||||
|  | 
 | ||||||
|  |             if not isinstance(ostypes, list): | ||||||
|  |                 raise Exception( | ||||||
|  |                     "Unable to find Ostype id with desc: %s" % | ||||||
|  |                                                 services["ostype"]) | ||||||
|  |             cmd.ostypeid = ostypes[0].id | ||||||
|  |         else: | ||||||
|  |             raise Exception( | ||||||
|  |                     "Unable to find Ostype is required for creating template") | ||||||
|  | 
 | ||||||
|         cmd.snapshotid = snapshot.id |         cmd.snapshotid = snapshot.id | ||||||
|         return Template(apiclient.createTemplate(cmd).__dict__) |         return Template(apiclient.createTemplate(cmd).__dict__) | ||||||
| 
 | 
 | ||||||
| @ -695,7 +744,23 @@ class Iso: | |||||||
|         cmd = registerIso.registerIsoCmd() |         cmd = registerIso.registerIsoCmd() | ||||||
|         cmd.displaytext = services["displaytext"] |         cmd.displaytext = services["displaytext"] | ||||||
|         cmd.name = services["name"] |         cmd.name = services["name"] | ||||||
|         cmd.ostypeid = services["ostypeid"] |         if "ostypeid" in services: | ||||||
|  |             cmd.ostypeid = services["ostypeid"] | ||||||
|  |         elif "ostype" in services: | ||||||
|  |             # Find OSTypeId from Os type | ||||||
|  |             sub_cmd = listOsTypes.listOsTypesCmd() | ||||||
|  |             sub_cmd.description = services["ostype"] | ||||||
|  |             ostypes = apiclient.listOsTypes(sub_cmd) | ||||||
|  | 
 | ||||||
|  |             if not isinstance(ostypes, list): | ||||||
|  |                 raise Exception( | ||||||
|  |                     "Unable to find Ostype id with desc: %s" % | ||||||
|  |                                                 services["ostype"]) | ||||||
|  |             cmd.ostypeid = ostypes[0].id | ||||||
|  |         else: | ||||||
|  |             raise Exception( | ||||||
|  |                     "Unable to find Ostype is required for creating ISO") | ||||||
|  | 
 | ||||||
|         cmd.url = services["url"] |         cmd.url = services["url"] | ||||||
|         cmd.zoneid = services["zoneid"] |         cmd.zoneid = services["zoneid"] | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -29,6 +29,30 @@ from base import * | |||||||
| import time | import time | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
|  | def wait_for_cleanup(apiclient, configs=None): | ||||||
|  |     """Sleeps till the cleanup configs passed""" | ||||||
|  | 
 | ||||||
|  |     # Configs list consists of the list of global configs | ||||||
|  |     if not isinstance(configs, list): | ||||||
|  |         return | ||||||
|  |     for config in configs: | ||||||
|  |         cmd = listConfigurations.listConfigurationsCmd() | ||||||
|  |         cmd.name = config | ||||||
|  |         cmd.listall = True | ||||||
|  |         try: | ||||||
|  |             config_descs = apiclient.listConfigurations(cmd) | ||||||
|  |         except Exception as e: | ||||||
|  |             raise Exception("Failed to fetch configurations: %s" % e) | ||||||
|  | 
 | ||||||
|  |         if not isinstance(config_descs, list): | ||||||
|  |             raise Exception("List configs didn't returned a valid data") | ||||||
|  | 
 | ||||||
|  |         config_desc = config_descs[0] | ||||||
|  |         # Sleep for the config_desc.value time | ||||||
|  |         time.sleep(int(config_desc.value)) | ||||||
|  |     return | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
| def get_domain(apiclient, services=None): | def get_domain(apiclient, services=None): | ||||||
|     "Returns a default domain" |     "Returns a default domain" | ||||||
| 
 | 
 | ||||||
| @ -79,9 +103,19 @@ def get_pod(apiclient, zoneid, services=None): | |||||||
|         raise Exception("Exception: Failed to find specified pod.") |         raise Exception("Exception: Failed to find specified pod.") | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| def get_template(apiclient, zoneid, ostypeid=12, services=None): | def get_template(apiclient, zoneid, ostype, services=None): | ||||||
|     "Returns a template" |     "Returns a template" | ||||||
| 
 | 
 | ||||||
|  |     cmd = listOsTypes.listOsTypesCmd() | ||||||
|  |     cmd.description = ostype | ||||||
|  |     ostypes = apiclient.listOsTypes(cmd) | ||||||
|  | 
 | ||||||
|  |     if isinstance(ostypes, list): | ||||||
|  |         ostypeid = ostypes[0].id | ||||||
|  |     else: | ||||||
|  |         raise Exception( | ||||||
|  |             "Failed to find OS type with description: %s" % ostype) | ||||||
|  | 
 | ||||||
|     cmd = listTemplates.listTemplatesCmd() |     cmd = listTemplates.listTemplatesCmd() | ||||||
|     cmd.templatefilter = 'featured' |     cmd.templatefilter = 'featured' | ||||||
|     cmd.zoneid = zoneid |     cmd.zoneid = zoneid | ||||||
| @ -265,6 +299,14 @@ def update_resource_limit(apiclient, resourcetype, account=None, | |||||||
|     return |     return | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
|  | def list_os_types(apiclient, **kwargs): | ||||||
|  |     """List all os types matching criteria""" | ||||||
|  | 
 | ||||||
|  |     cmd = listOsTypes.listOsTypesCmd() | ||||||
|  |     [setattr(cmd, k, v) for k, v in kwargs.items()] | ||||||
|  |     return(apiclient.listOsTypes(cmd)) | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
| def list_routers(apiclient, **kwargs): | def list_routers(apiclient, **kwargs): | ||||||
|     """List all Routers matching criteria""" |     """List all Routers matching criteria""" | ||||||
| 
 | 
 | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user