You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by ts...@apache.org on 2012/11/30 01:00:33 UTC

git commit: Summary: Removing ostypeid dependencies from tests

Updated Branches:
  refs/heads/master 6036f7372 -> 2c561dd3a


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 <ts...@apache.org> 1354228309 -0800


Project: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/commit/2c561dd3
Tree: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/tree/2c561dd3
Diff: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/diff/2c561dd3

Branch: refs/heads/master
Commit: 2c561dd3a8d125254fc3d707360a9a7f7789e64e
Parents: 6036f73
Author: Prasanna Santhanam <ts...@apache.org>
Authored: Thu Nov 29 14:31:49 2012 -0800
Committer: Prasanna Santhanam <ts...@apache.org>
Committed: Thu Nov 29 15:41:56 2012 -0800

----------------------------------------------------------------------
 test/integration/component/test_snapshots.py  |   24 +++----
 test/integration/smoke/test_iso.py            |   31 +++++++-
 test/integration/smoke/test_network.py        |   14 ++--
 test/integration/smoke/test_routers.py        |    4 +-
 test/integration/smoke/test_templates.py      |   18 ++++--
 test/integration/smoke/test_vm_life_cycle.py  |   12 ++--
 test/integration/smoke/test_volumes.py        |    8 +-
 tools/marvin/marvin/integration/lib/base.py   |   73 ++++++++++++++++++-
 tools/marvin/marvin/integration/lib/common.py |   44 ++++++++++++-
 9 files changed, 182 insertions(+), 46 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/2c561dd3/test/integration/component/test_snapshots.py
----------------------------------------------------------------------
diff --git a/test/integration/component/test_snapshots.py b/test/integration/component/test_snapshots.py
index 27c960f..8659f14 100644
--- a/test/integration/component/test_snapshots.py
+++ b/test/integration/component/test_snapshots.py
@@ -105,7 +105,7 @@ class Services:
                         "templates": {
                                     "displaytext": 'Template',
                                     "name": 'Template',
-                                    "ostypeid": '01853327-513e-4508-9628-f1f55db1946f',
+                                    "ostype": "CentOS 5.3 (64-bit)",
                                     "templatefilter": 'self',
                                 },
                         "diskdevice": "/dev/xvda",
@@ -117,8 +117,7 @@ class Services:
                         "sub_lvl_dir1": "test1",
                         "sub_lvl_dir2": "test2",
                         "random_data": "random.data",
-
-                        "ostypeid": '01853327-513e-4508-9628-f1f55db1946f',
+                        "ostype": "CentOS 5.3 (64-bit)",
                         # Cent OS 5.3 (64 bit)
                         "sleep": 60,
                         "timeout": 10,
@@ -139,11 +138,11 @@ class TestSnapshotRootDisk(cloudstackTestCase):
         template = get_template(
                             cls.api_client,
                             cls.zone.id,
-                            cls.services["ostypeid"]
+                            cls.services["ostype"]
                             )
         cls.services["domainid"] = cls.domain.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
 
         # Create VMs, NAT Rules etc
@@ -364,7 +363,7 @@ class TestSnapshots(cloudstackTestCase):
         template = get_template(
                             cls.api_client,
                             cls.zone.id,
-                            cls.services["ostypeid"]
+                            cls.services["ostype"]
                             )
         
         cls.services["domainid"] = cls.domain.id
@@ -373,7 +372,7 @@ class TestSnapshots(cloudstackTestCase):
 
         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["diskoffering"] = cls.disk_offering.id
 
@@ -1195,12 +1194,11 @@ class TestCreateVMsnapshotTemplate(cloudstackTestCase):
         cls.template = get_template(
                             cls.api_client,
                             cls.zone.id,
-                            cls.services["ostypeid"]
+                            cls.services["ostype"]
                             )
         cls.services["domainid"] = cls.domain.id
         cls.services["server"]["zoneid"] = cls.zone.id
 
-        cls.services["template"] = cls.template.id
 
         # Create VMs, NAT Rules etc
         cls.account = Account.create(
@@ -1491,7 +1489,7 @@ class TestAccountSnapshotClean(cloudstackTestCase):
         template = get_template(
                             cls.api_client,
                             cls.zone.id,
-                            cls.services["ostypeid"]
+                            cls.services["ostype"]
                             )
         cls.services["server"]["zoneid"] = cls.zone.id
 
@@ -1843,7 +1841,7 @@ class TestSnapshotDetachedDisk(cloudstackTestCase):
         template = get_template(
                             cls.api_client,
                             cls.zone.id,
-                            cls.services["ostypeid"]
+                            cls.services["ostype"]
                             )
         cls.services["server"]["zoneid"] = cls.zone.id
         cls.services["server"]["diskoffering"] = cls.disk_offering.id
@@ -2126,7 +2124,7 @@ class TestSnapshotLimit(cloudstackTestCase):
         template = get_template(
                             cls.api_client,
                             cls.zone.id,
-                            cls.services["ostypeid"]
+                            cls.services["ostype"]
                             )
         cls.services["server"]["zoneid"] = cls.zone.id
 
@@ -2384,7 +2382,7 @@ class TestSnapshotEvents(cloudstackTestCase):
         template = get_template(
                             cls.api_client,
                             cls.zone.id,
-                            cls.services["ostypeid"]
+                            cls.services["ostype"]
                             )
         cls.services["server"]["zoneid"] = cls.zone.id
 

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/2c561dd3/test/integration/smoke/test_iso.py
----------------------------------------------------------------------
diff --git a/test/integration/smoke/test_iso.py b/test/integration/smoke/test_iso.py
index 0215d89..2c14ed9 100644
--- a/test/integration/smoke/test_iso.py
+++ b/test/integration/smoke/test_iso.py
@@ -55,7 +55,7 @@ class Services:
                         "isextractable": True,
                         "isfeatured": True,
                         "ispublic": True,
-                        "ostypeid": '01853327-513e-4508-9628-f1f55db1946f',
+                        "ostype": "CentOS 5.3 (64-bit)",
                     },
             "iso_2":
                     {
@@ -66,7 +66,7 @@ class Services:
                         "isextractable": True,
                         "isfeatured": True,
                         "ispublic": True,
-                        "ostypeid": '01853327-513e-4508-9628-f1f55db1946f',
+                        "ostype": "CentOS 5.3 (64-bit)",
                         "mode": 'HTTP_DOWNLOAD',
                         # Used in Extract template, value must be HTTP_DOWNLOAD
                     },
@@ -79,7 +79,7 @@ class Services:
             "passwordenabled": True,
             "sleep": 60,
             "timeout": 10,
-            "ostypeid": '01853327-513e-4508-9628-f1f55db1946f',
+            "ostype": "CentOS 5.3 (64-bit)",
             # CentOS 5.3 (64 bit)
             "mode": 'advanced'
             # Networking mode: Basic or Advanced
@@ -103,7 +103,18 @@ class TestCreateIso(cloudstackTestCase):
                             self.services["account"],
                             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]
         return
 
@@ -200,6 +211,18 @@ class TestISO(cloudstackTestCase):
                             domainid=cls.domain.id
                             )
         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.api_client, 
                                cls.services["iso_1"],

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/2c561dd3/test/integration/smoke/test_network.py
----------------------------------------------------------------------
diff --git a/test/integration/smoke/test_network.py b/test/integration/smoke/test_network.py
index 0a3a3c3..e78cc43 100644
--- a/test/integration/smoke/test_network.py
+++ b/test/integration/smoke/test_network.py
@@ -36,7 +36,7 @@ class Services:
 
     def __init__(self):
         self.services = {
-                            "ostypeid": '01853327-513e-4508-9628-f1f55db1946f',
+                            "ostype": "CentOS 5.3 (64-bit)",
                             # Cent OS 5.3 (64 bit)
                             "mode": 'advanced',
                             # Networking mode: Basic or advanced
@@ -305,7 +305,7 @@ class TestPortForwarding(cloudstackTestCase):
         template = get_template(
                             cls.api_client,
                             cls.zone.id,
-                            cls.services["ostypeid"]
+                            cls.services["ostype"]
                             )
         #Create an account, network, VM and IP addresses
         cls.account = Account.create(
@@ -604,7 +604,7 @@ class TestLoadBalancingRule(cloudstackTestCase):
         template = get_template(
                             cls.api_client,
                             cls.zone.id,
-                            cls.services["ostypeid"]
+                            cls.services["ostype"]
                             )
         cls.services["server"]["zoneid"] = cls.zone.id
 
@@ -1076,7 +1076,7 @@ class TestRebootRouter(cloudstackTestCase):
         template = get_template(
                             self.apiclient,
                             self.zone.id,
-                            self.services["ostypeid"]
+                            self.services["ostype"]
                             )
         self.services["server"]["zoneid"] = self.zone.id
 
@@ -1236,7 +1236,7 @@ class TestAssignRemoveLB(cloudstackTestCase):
         template = get_template(
                             self.apiclient,
                             self.zone.id,
-                            self.services["ostypeid"]
+                            self.services["ostype"]
                             )
         self.services["server"]["zoneid"] = self.zone.id
 
@@ -1495,7 +1495,7 @@ class TestReleaseIP(cloudstackTestCase):
         template = get_template(
                             self.apiclient,
                             self.zone.id,
-                            self.services["ostypeid"]
+                            self.services["ostype"]
                             )
         self.services["server"]["zoneid"] = self.zone.id
 
@@ -1635,7 +1635,7 @@ class TestDeleteAccount(cloudstackTestCase):
         template = get_template(
                             self.apiclient,
                             self.zone.id,
-                            self.services["ostypeid"]
+                            self.services["ostype"]
                             )
         self.services["server"]["zoneid"] = self.zone.id
 

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/2c561dd3/test/integration/smoke/test_routers.py
----------------------------------------------------------------------
diff --git a/test/integration/smoke/test_routers.py b/test/integration/smoke/test_routers.py
index 9675339..93dc760 100644
--- a/test/integration/smoke/test_routers.py
+++ b/test/integration/smoke/test_routers.py
@@ -61,7 +61,7 @@ class Services:
                                         "username": "testuser",
                                         "password": "password",
                                         },
-                         "ostypeid":'01853327-513e-4508-9628-f1f55db1946f',
+                         "ostype": "CentOS 5.3 (64-bit)",
                          "sleep": 60,
                          "timeout": 10,
                          "mode": 'advanced', #Networking mode: Basic, Advanced
@@ -84,7 +84,7 @@ class TestRouterServices(cloudstackTestCase):
         template = get_template(
                             cls.api_client,
                             cls.zone.id,
-                            cls.services["ostypeid"]
+                            cls.services["ostype"]
                             )
         cls.services["virtual_machine"]["zoneid"] = cls.zone.id
 

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/2c561dd3/test/integration/smoke/test_templates.py
----------------------------------------------------------------------
diff --git a/test/integration/smoke/test_templates.py b/test/integration/smoke/test_templates.py
index 9a7f6b1..26d59f7 100644
--- a/test/integration/smoke/test_templates.py
+++ b/test/integration/smoke/test_templates.py
@@ -75,12 +75,12 @@ class Services:
                          "template_1": {
                                 "displaytext": "Cent OS Template",
                                 "name": "Cent OS Template",
-                                "ostypeid": '01853327-513e-4508-9628-f1f55db1946f',
+                                "ostype": "CentOS 5.3 (64-bit)",
                          },
                          "template_2": {
                                 "displaytext": "Public Template",
                                 "name": "Public template",
-                                "ostypeid": '01853327-513e-4508-9628-f1f55db1946f',
+                                "ostype": "CentOS 5.3 (64-bit)",
                                 "isfeatured": True,
                                 "ispublic": True,
                                 "isextractable": True,
@@ -94,7 +94,7 @@ class Services:
                         "isextractable": False,
                         "bootable": True,
                         "passwordenabled": True,
-                        "ostypeid": '01853327-513e-4508-9628-f1f55db1946f',
+                        "ostype": "CentOS 5.3 (64-bit)",
                         "mode": 'advanced',
                         # Networking mode: Advanced, basic
                         "sleep": 30,
@@ -135,8 +135,12 @@ class TestCreateTemplate(cloudstackTestCase):
         template = get_template(
                             cls.api_client,
                             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["volume"]["diskoffering"] = cls.disk_offering.id
         cls.services["volume"]["zoneid"] = cls.zone.id
@@ -298,7 +302,7 @@ class TestTemplates(cloudstackTestCase):
         template = get_template(
                             cls.api_client,
                             cls.zone.id,
-                            cls.services["ostypeid"]
+                            cls.services["ostype"]
                             )
         cls.services["virtual_machine"]["zoneid"] = cls.zone.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["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.api_client,
                             cls.services["account"],

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/2c561dd3/test/integration/smoke/test_vm_life_cycle.py
----------------------------------------------------------------------
diff --git a/test/integration/smoke/test_vm_life_cycle.py b/test/integration/smoke/test_vm_life_cycle.py
index a6d0c10..50c75d1 100644
--- a/test/integration/smoke/test_vm_life_cycle.py
+++ b/test/integration/smoke/test_vm_life_cycle.py
@@ -109,7 +109,7 @@ class Services:
                     "name": "testISO",
                     "url": "http://iso.linuxquestions.org/download/504/1819/http/gd4.tuwien.ac.at/dsl-4.4.10.iso",
                      # Source URL where ISO is located
-                    "ostypeid": '01853327-513e-4508-9628-f1f55db1946f',
+                    "ostype": 'CentOS 5.3 (64-bit)',
                     "mode": 'HTTP_DOWNLOAD', # Downloading existing ISO 
                 },
                 "template": {
@@ -123,7 +123,7 @@ class Services:
             "sleep": 60,
             "timeout": 10,
             #Migrate VM to hostid
-            "ostypeid": '01853327-513e-4508-9628-f1f55db1946f',
+            "ostype": 'CentOS 5.3 (64-bit)',
             # CentOS 5.3 (64-bit)
             "mode":'advanced',
         }
@@ -143,7 +143,7 @@ class TestDeployVM(cloudstackTestCase):
         template = get_template(
                             self.apiclient,
                             zone.id,
-                            self.services["ostypeid"]
+                            self.services["ostype"]
                             )
         # Set Zones and disk offerings
         self.services["small"]["zoneid"] = zone.id
@@ -245,7 +245,7 @@ class TestVMLifeCycle(cloudstackTestCase):
         template = get_template(
                             cls.api_client,
                             zone.id,
-                            cls.services["ostypeid"]
+                            cls.services["ostype"]
                             )
         # Set Zones and disk offerings
         cls.services["small"]["zoneid"] = zone.id
@@ -999,7 +999,7 @@ class TestVMPasswordEnabled(cloudstackTestCase):
         template = get_template(
                             cls.api_client,
                             zone.id,
-                            cls.services["ostypeid"]
+                            cls.services["ostype"]
                             )
         # Set Zones and disk offerings
         cls.services["small"]["zoneid"] = zone.id
@@ -1065,7 +1065,7 @@ class TestVMPasswordEnabled(cloudstackTestCase):
                 "Exception: Unable to find root volume foe VM: %s" %
                                                     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
         cls.pw_enabled_template = Template.create(
                                          cls.api_client,

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/2c561dd3/test/integration/smoke/test_volumes.py
----------------------------------------------------------------------
diff --git a/test/integration/smoke/test_volumes.py b/test/integration/smoke/test_volumes.py
index f812808..2d0cd49 100644
--- a/test/integration/smoke/test_volumes.py
+++ b/test/integration/smoke/test_volumes.py
@@ -75,8 +75,8 @@ class Services:
                         "publicport": 22,
                         "protocol": 'TCP',
                         "diskdevice": "/dev/xvdb",
-                        "ostypeid": '01853327-513e-4508-9628-f1f55db1946f',
-                        "mode": 'advanced',
+                        "ostype": 'CentOS 5.3 (64-bit)',
+                        "mode": 'basic',
                         "sleep": 60,
                         "timeout": 10,
                     }
@@ -104,7 +104,7 @@ class TestCreateVolume(cloudstackTestCase):
         template = get_template(
                             cls.api_client,
                             cls.zone.id,
-                            cls.services["ostypeid"]
+                            cls.services["ostype"]
                             )
         cls.services["domainid"] = cls.domain.id
         cls.services["zoneid"] = cls.zone.id
@@ -286,7 +286,7 @@ class TestVolumes(cloudstackTestCase):
         template = get_template(
                             cls.api_client,
                             cls.zone.id,
-                            cls.services["ostypeid"]
+                            cls.services["ostype"]
                             )
         cls.services["domainid"] = cls.domain.id
         cls.services["zoneid"] = cls.zone.id

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/2c561dd3/tools/marvin/marvin/integration/lib/base.py
----------------------------------------------------------------------
diff --git a/tools/marvin/marvin/integration/lib/base.py b/tools/marvin/marvin/integration/lib/base.py
index 5001daf..66754bd 100644
--- a/tools/marvin/marvin/integration/lib/base.py
+++ b/tools/marvin/marvin/integration/lib/base.py
@@ -547,7 +547,22 @@ class Template:
         cmd = createTemplate.createTemplateCmd()
         cmd.displaytext = services["displaytext"]
         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.ispublic = services["ispublic"] if "ispublic" in services else False
@@ -579,7 +594,24 @@ class Template:
         cmd.name = "-".join([services["name"], random_gen()])
         cmd.format = services["format"]
         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"]
 
         if zoneid:
@@ -615,7 +647,24 @@ class Template:
                              services["name"],
                              random_gen()
                             ]) 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
         return Template(apiclient.createTemplate(cmd).__dict__)
 
@@ -695,7 +744,23 @@ class Iso:
         cmd = registerIso.registerIsoCmd()
         cmd.displaytext = services["displaytext"]
         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.zoneid = services["zoneid"]
 

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/2c561dd3/tools/marvin/marvin/integration/lib/common.py
----------------------------------------------------------------------
diff --git a/tools/marvin/marvin/integration/lib/common.py b/tools/marvin/marvin/integration/lib/common.py
index b1c87bc..de68178 100644
--- a/tools/marvin/marvin/integration/lib/common.py
+++ b/tools/marvin/marvin/integration/lib/common.py
@@ -29,6 +29,30 @@ from base import *
 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):
     "Returns a default domain"
 
@@ -79,9 +103,19 @@ def get_pod(apiclient, zoneid, services=None):
         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"
 
+    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.templatefilter = 'featured'
     cmd.zoneid = zoneid
@@ -265,6 +299,14 @@ def update_resource_limit(apiclient, resourcetype, account=None,
     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):
     """List all Routers matching criteria"""