You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by gi...@apache.org on 2014/01/22 07:52:24 UTC

[1/4] CLOUDSTACK-5674: Added Fix for CLOUDSTACK-5674, 5498, 5500 and other issues as part of cleanup

Updated Branches:
  refs/heads/marvin 99b9198de -> 6a2cc9fbd


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/93932756/tools/marvin/marvin/config/test_data.cfg
----------------------------------------------------------------------
diff --git a/tools/marvin/marvin/config/test_data.cfg b/tools/marvin/marvin/config/test_data.cfg
new file mode 100644
index 0000000..ef0a6b3
--- /dev/null
+++ b/tools/marvin/marvin/config/test_data.cfg
@@ -0,0 +1,160 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+# Use the common configs added such as account, network_offerings, domain, project,
+# or add your own data if required separately for any test case
+{
+        "zone": "NA",
+        "domain":
+                    {
+                        "name": "domain"
+                    }
+                  ,
+        "project":
+        {
+                    "name": "Project",
+                    "displaytext": "Test project"
+                   },
+        "account": {
+                    "email": "test-account@test.com",
+                    "firstname": "test",
+                    "lastname": "test",
+                    "username": "test-account",
+                    "password": "password"
+                    },
+        "service_offering": {
+                             "name": "Tiny Instance",
+                             "displaytext": "Tiny Instance",
+                             "cpunumber": 1,
+                             "cpuspeed": 100,
+                             "memory": 128
+                            },
+        "isolated_network_offering": {
+                                      "name": "Network offering-DA services",
+                                      "displaytext": "Network offering-DA services",
+                                      "guestiptype": "Isolated",
+                                      "supportedservices": "Dhcp,Dns,SourceNat,PortForwarding,Vpn,Firewall,Lb,UserData,StaticNat",
+                                      "traffictype": "GUEST",
+                                      "availability": "Optional'",
+                                      "serviceProviderList": {
+                                            "Dhcp": "VirtualRouter",
+                                            "Dns": "VirtualRouter",
+                                            "SourceNat": "VirtualRouter",
+                                            "PortForwarding": "VirtualRouter",
+                                            "Vpn": "VirtualRouter",
+                                            "Firewall": "VirtualRouter",
+                                            "Lb": "VirtualRouter",
+                                            "UserData": "VirtualRouter",
+                                            "StaticNat": "VirtualRouter"
+                                        }
+                                    },
+        "isolated_network": {
+                             "name": "Isolated Network",
+                             "displaytext": "Isolated Network"
+                            },
+        "virtual_machine": {
+                            "displayname": "Test VM",
+                            "username": "root",
+                            "password": "password",
+                            "ssh_port": 22,
+                            "privateport": 22,
+                            "publicport": 22,
+                            "protocol": "TCP"
+                            },
+        "shared_network": {
+                           "name": "MySharedNetwork - Test",
+                           "displaytext": "MySharedNetwork",
+                           "vlan" : "",
+                           "gateway" :"",
+                           "netmask" :"",
+                           "startip" :"",
+                           "endip" :"",
+                           "acltype" : "Domain",
+                           "scope":"all"
+                          },
+        "shared_network_offering_sg": {
+                                    "name": "MySharedOffering-sg",
+                                    "displaytext": "MySharedOffering-sg",
+                                    "guestiptype": "Shared",
+                                    "supportedservices": "Dhcp,Dns,UserData,SecurityGroup",
+                                    "specifyVlan" : "False",
+                                    "specifyIpRanges" : "False",
+                                    "traffictype": "GUEST",
+                                    "serviceProviderList" : {
+                                            "Dhcp": "VirtualRouter",
+                                            "Dns": "VirtualRouter",
+                                            "UserData": "VirtualRouter",
+                                            "SecurityGroup": "SecurityGroupProvider"
+                                        }
+                                },
+        "shared_network_sg": {
+                                  "name": "Shared-Network-SG-Test",
+                                  "displaytext": "Shared-Network_SG-Test",
+                                  "networkofferingid":"1",
+                                  "vlan" : "",
+                                  "gateway" :"",
+                                  "netmask" :"255.255.255.0",
+                                  "startip" :"",
+                                  "endip" :"",
+                                  "acltype" : "Domain",
+                                  "scope":"all"
+                                },
+        "vpc_offering": {
+                         "name": "VPC off",
+                         "displaytext": "VPC off",
+                         "supportedservices": "Dhcp,Dns,SourceNat,PortForwarding,Vpn,Lb,UserData,StaticNat,NetworkACL"
+                        },
+        "vpc": {
+                "name": "TestVPC",
+                "displaytext": "TestVPC",
+                "cidr": "10.0.0.1/24"
+                },
+        "shared_network_offering": {
+                                    "name": "MySharedOffering",
+                                    "displaytext": "MySharedOffering",
+                                    "guestiptype": "Shared",
+                                    "supportedservices": "Dhcp,Dns,UserData",
+                                    "specifyVlan" : "False",
+                                    "specifyIpRanges" : "False",
+                                    "traffictype": "GUEST",
+                                    "serviceProviderList" : {
+                                            "Dhcp": "VirtualRouter",
+                                            "Dns": "VirtualRouter",
+                                            "UserData": "VirtualRouter"
+                                        }
+                                },
+        "security_group" : { "name": "custom_Sec_Grp" },
+        "ingress_rule": {
+                         "protocol": "TCP",
+                         "startport": "22",
+                         "endport": "22",
+                         "cidrlist": "0.0.0.0/0"
+                        },
+        "ostype": "CentOS 5.3 (64-bit)",
+        "sleep": 90,
+        "timeout": 10,
+        "advanced_sg": {
+                         "zone": {
+                                    "name": "",
+                                    "dns1": "8.8.8.8",
+                                    "internaldns1": "192.168.100.1",
+                                    "networktype": "Advanced",
+                                    "securitygroupenabled": "true"
+                                },
+                         "securitygroupenabled": "true"
+                       }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/93932756/tools/marvin/marvin/configGenerator.py
----------------------------------------------------------------------
diff --git a/tools/marvin/marvin/configGenerator.py b/tools/marvin/marvin/configGenerator.py
index 0d79e8e..245473a 100644
--- a/tools/marvin/marvin/configGenerator.py
+++ b/tools/marvin/marvin/configGenerator.py
@@ -50,9 +50,13 @@ class configuration(object):
 
 class logger(object):
     def __init__(self):
-        '''TestCase/TestClient'''
-        self.name = None
-        self.file = None
+        self.LogFolderPath = None
+
+
+class apiLoadCfg(object):
+    def __init__(self):
+        self.ParsedApiDestFolder = None
+        self.ApiSpecFile = None
 
 
 class cloudstackConfiguration(object):
@@ -296,9 +300,8 @@ class bigip(object):
 
 
 class ConfigManager(object):
-
     '''
-    @Name: configManager
+    @Name: ConfigManager
     @Desc: 1. It provides the basic configuration facilities to marvin.
            2. User can just add configuration files for his tests, deployment
               etc, under one config folder before running their tests.
@@ -328,17 +331,22 @@ class ConfigManager(object):
            8. Users can use their own configuration file passed to
               "getConfig" API,once configObj is returned.
     '''
+    def __init__(self, cfg_file=None):
+        if cfg_file is None:
+            self.__filePath = "config/test_data.cfg"
+        else:
+            self.__filePath = cfg_file
+        self.__parsedCfgDict = None
+        '''
+        Set the Configuration
+        '''
+        self.__setConfig()
 
-    def __init__(self):
-        # Joining path with current directory will avoid relative path issue
-        # It will take correct path irrespective of from where the test case is run
-        dirPath = os.path.dirname(__file__)
-        self.filePath = os.path.join(dirPath, 'config/config.cfg')
-        self.parsedDict = None
-        if self.__verifyFile(self.filePath) is not False:
-            self.parsedDict = self.__parseConfig(self.filePath)
-
-    def __parseConfig(self, file):
+    def __setConfig(self):
+        if self.__verifyFile() is not False:
+            self.__parsedCfgDict = self.__parseConfig()
+
+    def __parseConfig(self):
         '''
         @Name : __parseConfig
         @Description: Parses the Input configuration Json file
@@ -363,22 +371,20 @@ class ConfigManager(object):
         finally:
             return config_dict
 
-    def __verifyFile(self, file):
+    def __verifyFile(self):
         '''
         @Name : __parseConfig
         @Description: Parses the Input configuration Json file
                   and returns a dictionary from the file.
-        @Input      : file NA
+        @Input      : NA
         @Output     : True or False based upon file input validity
                       and availability
         '''
-        if file is None or file == '':
-            return False
-        if os.path.exists(file) is False:
+        if self.__filePath is None or self.__filePath == '':
             return False
-        return True
+        return False if os.path.exists(self.__filePath) is False else True
 
-    def __getSectionData(self, return_dict, section=None):
+    def getSectionData(self, section=None):
         '''
         @Name: getSectionData
         @Desc: Gets the Section data of a particular section
@@ -387,35 +393,21 @@ class ConfigManager(object):
                 section to be returned from this dict
         @Output:Section matching inside the parsed data
         '''
-        if return_dict is not None:
-            inp = return_dict
-        elif self.parsedDict is None:
+        if self.__parsedCfgDict is None or section is None:
+            print "\nEither Parsed Dictionary is None or Section is None"
             return INVALID_INPUT
-        else:
-            inp = self.parsedDict
-
         if section is not None:
-            return inp.get(section)
-        else:
-            return inp
+            return self.__parsedCfgDict.get(section)
 
-    def getConfig(self, file_path=None, section=None):
+    def getConfig(self):
         '''
-        @Name: getConfig
-        @Desc  : Parses and converts the given configuration file to dictionary
-        @Input : file_path: path where the configuration needs to be passed
-                 section: specific section inside the file
-        @Output: INVALID_INPUT: This value is returned if the input
-                              is invalid or not able to be parsed
-                 Parsed configuration dictionary from json file
+        @Name  : getConfig
+        @Desc  : Returns the Parsed Dictionary of Config Provided
+        @Input : NA
+        @Output: ParsedDict if successful if  cfg file provided is valid
+                 None if cfg file is invalid or not able to be parsed
         '''
-        ret = None
-        if file not in [None, '']:
-            if self.__verifyFile(file_path) is False:
-                return INVALID_INPUT
-            else:
-                ret = self.__parseConfig(file_path)
-        return self.__getSectionData(ret, section)
+        return self.__parsedCfgDict
 
 
 def getDeviceUrl(obj):

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/93932756/tools/marvin/marvin/dbConnection.py
----------------------------------------------------------------------
diff --git a/tools/marvin/marvin/dbConnection.py b/tools/marvin/marvin/dbConnection.py
index 99014ab..422fcfa 100644
--- a/tools/marvin/marvin/dbConnection.py
+++ b/tools/marvin/marvin/dbConnection.py
@@ -25,7 +25,7 @@ import sys
 import os
 
 
-class dbConnection(object):
+class DbConnection(object):
     def __init__(self, host="localhost", port=3306, user='cloud',
                  passwd='cloud', db='cloud'):
         self.host = host
@@ -68,7 +68,7 @@ class dbConnection(object):
         return self.execute(sqls)
 
 if __name__ == "__main__":
-    db = dbConnection()
+    db = DbConnection()
     '''
     try:
 

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/93932756/tools/marvin/marvin/deployDataCenter.py
----------------------------------------------------------------------
diff --git a/tools/marvin/marvin/deployDataCenter.py b/tools/marvin/marvin/deployDataCenter.py
index c4f6e1e..85a31d3 100644
--- a/tools/marvin/marvin/deployDataCenter.py
+++ b/tools/marvin/marvin/deployDataCenter.py
@@ -17,20 +17,28 @@
 
 """Deploy datacenters according to a json configuration file"""
 import configGenerator
-import cloudstackException
-import cloudstackTestClient
+from cloudstackException import (
+    InvalidParameterException,
+    GetDetailExceptionInfo)
+
 import logging
 from cloudstackAPI import *
 from os import path
 from time import sleep
 from optparse import OptionParser
+from marvin.codes import (FAILED, SUCCESS)
+from sys import exit
 
 
-class deployDataCenters(object):
-
-    def __init__(self, cfg, logger=None):
+class DeployDataCenters(object):
+    '''
+    @Desc : Deploys the Data Center with information provided
+    '''
+    def __init__(self, test_client, cfg, logger=None):
+        self.testClient = test_client
         self.config = cfg
         self.tcRunLogger = logger
+        self.apiClient = None
 
     def addHosts(self, hosts, zoneId, podId, clusterId, hypervisor):
         if hosts is None:
@@ -50,7 +58,9 @@ class deployDataCenters(object):
             hostcmd.username = host.username
             hostcmd.zoneid = zoneId
             hostcmd.hypervisor = hypervisor
-            self.apiClient.addHost(hostcmd)
+            if self.apiClient.addHost(hostcmd) == FAILED:
+                self.tcRunLogger.exception("=== Adding Host Failed===")
+                exit(1)
 
     def addVmWareDataCenter(self, vmwareDc):
         vdc = addVmwareDc.addVmwareDcCmd()
@@ -59,12 +69,13 @@ class deployDataCenters(object):
         vdc.vcenter = vmwareDc.vcenter
         vdc.username = vmwareDc.username
         vdc.password = vmwareDc.password
-        self.apiClient.addVmwareDc(vdc)
+        if self.apiClient.addVmwareDc(vdc) == FAILED:
+            self.tcRunLogger.exception("=== Adding VmWare DC Failed===")
+            exit(1)
 
     def createClusters(self, clusters, zoneId, podId, vmwareDc=None):
         if clusters is None:
             return
-
         if vmwareDc is not None:
             vmwareDc.zoneid = zoneId
             self.addVmWareDataCenter(vmwareDc)
@@ -80,13 +91,22 @@ class deployDataCenters(object):
             clustercmd.username = cluster.username
             clustercmd.zoneid = zoneId
             clusterresponse = self.apiClient.addCluster(clustercmd)
-            clusterId = clusterresponse[0].id
-
+            if clusterresponse != FAILED and clusterresponse[0].id is not None:
+                clusterId = clusterresponse[0].id
+                self.tcRunLogger.\
+                    debug("Cluster Name : %s Id : %s Created Successfully"
+                          % (str(cluster.clustername), str(clusterId)))
+            else:
+                self.tcRunLogger.exception("====Cluster %s Creation Failed"
+                                           "=====" % str(cluster.clustername))
+                exit(1)
             if cluster.hypervisor.lower() != "vmware":
                 self.addHosts(cluster.hosts, zoneId, podId, clusterId,
                               cluster.hypervisor)
             self.waitForHost(zoneId, clusterId)
-            self.createPrimaryStorages(cluster.primaryStorages, zoneId, podId,
+            self.createPrimaryStorages(cluster.primaryStorages,
+                                       zoneId,
+                                       podId,
                                        clusterId)
 
     def waitForHost(self, zoneId, clusterId):
@@ -99,6 +119,9 @@ class deployDataCenters(object):
         cmd = listHosts.listHostsCmd()
         cmd.clusterid, cmd.zoneid = clusterId, zoneId
         hosts = self.apiClient.listHosts(cmd)
+        if hosts == FAILED:
+            self.tcRunLogger.exception("=== List Hosts Failed===")
+            exit(1)
         while retry != 0:
             for host in hosts:
                 if host.state != 'Up':
@@ -106,7 +129,11 @@ class deployDataCenters(object):
             sleep(timeout)
             retry = retry - 1
 
-    def createPrimaryStorages(self, primaryStorages, zoneId, podId, clusterId):
+    def createPrimaryStorages(self,
+                              primaryStorages,
+                              zoneId,
+                              podId,
+                              clusterId):
         if primaryStorages is None:
             return
         for primary in primaryStorages:
@@ -118,9 +145,15 @@ class deployDataCenters(object):
             primarycmd.url = primary.url
             primarycmd.zoneid = zoneId
             primarycmd.clusterid = clusterId
-            self.apiClient.createStoragePool(primarycmd)
-
-    def createPods(self, pods, zoneId, networkId=None):
+            if self.apiClient.createStoragePool(primarycmd) == FAILED:
+                self.tcRunLogger.\
+                    exception("=== Create Storage Pool Failed===")
+                exit(1)
+
+    def createPods(self,
+                   pods,
+                   zoneId,
+                   networkId=None):
         if pods is None:
             return
         for pod in pods:
@@ -132,7 +165,17 @@ class deployDataCenters(object):
             createpod.endip = pod.endip
             createpod.zoneid = zoneId
             createpodResponse = self.apiClient.createPod(createpod)
-            podId = createpodResponse.id
+            if createpodResponse != \
+                    FAILED and createpodResponse.id is not None:
+                podId = createpodResponse.id
+                self.tcRunLogger.debug("Pod Name : %s Id : %s "
+                                       "Created Successfully" %
+                                       (str(pod.name), str(podId)))
+            else:
+                self.tcRunLogger.\
+                    exception("====Pod: %s Creation "
+                              "Failed=====" % str(pod.name))
+                exit(1)
 
             if pod.guestIpRanges is not None and networkId is not None:
                 self.createVlanIpRanges("Basic", pod.guestIpRanges, zoneId,
@@ -164,7 +207,10 @@ class deployDataCenters(object):
                     vlanipcmd.forvirtualnetwork = "false"
             else:
                 vlanipcmd.forvirtualnetwork = "true"
-            self.apiClient.createVlanIpRange(vlanipcmd)
+            if self.apiClient.createVlanIpRange(vlanipcmd) == FAILED:
+                self.tcRunLogger.\
+                    exception("=== Create Vlan Ip Range Failed===")
+                exit(1)
 
     def createSecondaryStorages(self, secondaryStorages, zoneId):
         if secondaryStorages is None:
@@ -184,7 +230,10 @@ class deployDataCenters(object):
                                                 })
             if secondarycmd.provider == "NFS":
                 secondarycmd.zoneid = zoneId
-            self.apiClient.addImageStore(secondarycmd)
+            if self.apiClient.addImageStore(secondarycmd) == FAILED:
+                self.tcRunLogger.\
+                    exception("=== Add Image Store Failed===")
+                exit(1)
 
     def createCacheStorages(self, cacheStorages, zoneId):
         if cacheStorages is None:
@@ -203,7 +252,11 @@ class deployDataCenters(object):
                                             'key': key,
                                             'value': value
                                             })
-            self.apiClient.createSecondaryStagingStore(cachecmd)
+            if self.apiClient.createSecondaryStagingStore(cachecmd) == FAILED:
+                self.tcRunLogger.\
+                    exception("=== Create "
+                              "SecondaryStagingStorage Failed===")
+                exit(1)
 
     def createNetworks(self, networks, zoneId):
         if networks is None:
@@ -224,7 +277,17 @@ class deployDataCenters(object):
                 networkcmd.netmask = iprange.netmask
 
             networkcmdresponse = self.apiClient.createNetwork(networkcmd)
-            networkId = networkcmdresponse.id
+            if networkcmdresponse != \
+                    FAILED and networkcmdresponse.id is not None:
+                networkId = networkcmdresponse.id
+                self.tcRunLogger.\
+                    debug("Network Name : %s Id : %s Created Successfully"
+                          % (str(network.name), str(networkId)))
+            else:
+                self.tcRunLogger.\
+                    exception("====Network : %s "
+                              "Creation Failed=====" % str(network.name))
+                exit(1)
             return networkId
 
     def createPhysicalNetwork(self, net, zoneid):
@@ -233,30 +296,48 @@ class deployDataCenters(object):
         phynet.name = net.name
         phynet.isolationmethods = net.isolationmethods
         phynetwrk = self.apiClient.createPhysicalNetwork(phynet)
+        if phynetwrk != FAILED and phynetwrk.id is not None:
+            self.tcRunLogger.debug("Physical Network Name : %s Id : %s "
+                                   "Created Successfully" %
+                                   (str(phynet.name),
+                                    str(phynetwrk.id)))
+        else:
+            self.tcRunLogger.exception("====Physical Network "
+                                       "Creation Failed=====")
+            exit(1)
         self.addTrafficTypes(phynetwrk.id, net.traffictypes)
         return phynetwrk
 
-    def updatePhysicalNetwork(self, networkid, state="Enabled", vlan=None):
+    def updatePhysicalNetwork(self, networkid, state="Enabled",
+                              vlan=None):
         upnet = updatePhysicalNetwork.updatePhysicalNetworkCmd()
         upnet.id = networkid
         upnet.state = state
         if vlan:
             upnet.vlan = vlan
-        return self.apiClient.updatePhysicalNetwork(upnet)
+        ret = self.apiClient.updatePhysicalNetwork(upnet)
+        if ret == FAILED:
+            self.tcRunLogger.\
+                exception("====Update Physical Network Failed=====")
+            exit(1)
+        else:
+            return ret
 
     def enableProvider(self, provider_id):
         upnetprov =\
             updateNetworkServiceProvider.updateNetworkServiceProviderCmd()
         upnetprov.id = provider_id
         upnetprov.state = "Enabled"
-        self.apiClient.updateNetworkServiceProvider(upnetprov)
+        if self.apiClient.updateNetworkServiceProvider(upnetprov) == FAILED:
+            self.tcRunLogger.\
+                exception("====Update Network Service Provider Failed=====")
+            exit(1)
 
     def configureProviders(self, phynetwrk, providers):
         """
         We will enable the virtualrouter elements for all zones. Other
         providers like NetScalers, SRX, etc are explicitly added/configured
         """
-
         for provider in providers:
             pnetprov = listNetworkServiceProviders.\
                 listNetworkServiceProvidersCmd()
@@ -264,6 +345,11 @@ class deployDataCenters(object):
             pnetprov.state = "Disabled"
             pnetprov.name = provider.name
             pnetprovres = self.apiClient.listNetworkServiceProviders(pnetprov)
+            if pnetprovres == FAILED:
+                self.tcRunLogger.\
+                    exception("====List Network "
+                              "Service Providers Failed=====")
+                exit(1)
 
             if pnetprovres and len(pnetprovres) > 0:
                 if provider.name == 'VirtualRouter'\
@@ -280,7 +366,13 @@ class deployDataCenters(object):
                         configureVirtualRouterElementCmd()
                     vrconfig.enabled = "true"
                     vrconfig.id = vrprovid
-                    self.apiClient.configureVirtualRouterElement(vrconfig)
+                    if self.apiClient.\
+                        configureVirtualRouterElement(vrconfig) == \
+                            FAILED:
+                        self.tcRunLogger.\
+                            exception("====ConfigureVirtualRouterElement "
+                                      "Failed=====")
+                        exit(1)
                     self.enableProvider(pnetprovres[0].id)
                 elif provider.name == 'InternalLbVm':
                     internallbprov = listInternalLoadBalancerElements.\
@@ -288,8 +380,13 @@ class deployDataCenters(object):
                     internallbprov.nspid = pnetprovres[0].id
                     internallbresponse = self.apiClient.\
                         listInternalLoadBalancerElements(internallbprov)
+                    if internallbresponse == FAILED:
+                        self.tcRunLogger.\
+                            exception("====List "
+                                      "InternalLoadBalancerElements "
+                                      "Failed=====")
+                        exit(1)
                     internallbid = internallbresponse[0].id
-
                     internallbconfig = \
                         configureInternalLoadBalancerElement.\
                         configureInternalLoadBalancerElementCmd()
@@ -333,9 +430,10 @@ class deployDataCenters(object):
                         dev.physicalnetworkid = phynetwrk.id
                         self.apiClient.addF5LoadBalancer(dev)
                     else:
-                        raise cloudstackException.\
-                            InvalidParameterException("Device %s doesn't match\
- any know provider type" % device)
+                        raise InvalidParameterException("Device %s "
+                                                        "doesn't match "
+                                                        "any know provider "
+                                                        "type" % device)
                 self.enableProvider(result.id)
 
     def addTrafficTypes(self, physical_network_id, traffictypes):
@@ -354,19 +452,32 @@ class deployDataCenters(object):
             if traffictype.vmware is not None else None
         traffic_type.simulatorlabel = traffictype.simulator\
             if traffictype.simulator is not None else None
-        return self.apiClient.addTrafficType(traffic_type)
+        ret = self.apiClient.addTrafficType(traffic_type)
+        if ret == FAILED:
+            self.tcRunLogger.\
+                exception("==== Add TrafficType Failed=====")
+        else:
+            return ret
 
     def enableZone(self, zoneid, allocation_state="Enabled"):
         zoneCmd = updateZone.updateZoneCmd()
         zoneCmd.id = zoneid
         zoneCmd.allocationstate = allocation_state
-        return self.apiClient.updateZone(zoneCmd)
+        ret = self.apiClient.updateZone(zoneCmd)
+        if ret == FAILED:
+            self.tcRunLogger.exception("==== Update Zone Failed=====")
+        else:
+            return ret
 
     def updateZoneDetails(self, zoneid, details):
         zoneCmd = updateZone.updateZoneCmd()
         zoneCmd.id = zoneid
         zoneCmd.details = details
-        return self.apiClient.updateZone(zoneCmd)
+        ret = self.apiClient.updateZone(zoneCmd)
+        if ret == FAILED:
+            self.tcRunLogger.exception("==== Update Zone  Failed=====")
+        else:
+            return ret
 
     def createZones(self, zones):
         for zone in zones:
@@ -383,7 +494,16 @@ class deployDataCenters(object):
                 createzone.guestcidraddress = zone.guestcidraddress
 
             zoneresponse = self.apiClient.createZone(createzone)
-            zoneId = zoneresponse.id
+            if zoneresponse != FAILED and zoneresponse.id is not None:
+                zoneId = zoneresponse.id
+                self.tcRunLogger.debug("Zone Name : %s Id : %s "
+                                       "Created Successfully" %
+                                       (str(zone.name), str(zoneId)))
+            else:
+                self.tcRunLogger.\
+                    exception("====ZoneCreation :  %s Failed=====" %
+                              str(zone.name))
+                exit(1)
 
             for pnet in zone.physical_networks:
                 phynetwrk = self.createPhysicalNetwork(pnet, zoneId)
@@ -406,7 +526,11 @@ class deployDataCenters(object):
 
                 listnetworkofferingresponse = \
                     self.apiClient.listNetworkOfferings(listnetworkoffering)
-
+                if listnetworkofferingresponse == FAILED:
+                    self.tcRunLogger.\
+                        exception("==== "
+                                  "ListNetworkOfferingResponse Failed=====")
+                    exit(1)
                 guestntwrk = configGenerator.network()
                 guestntwrk.displaytext = "guestNetworkForBasicZone"
                 guestntwrk.name = "guestNetworkForBasicZone"
@@ -437,7 +561,11 @@ class deployDataCenters(object):
 
                 listnetworkofferingresponse = \
                     self.apiClient.listNetworkOfferings(listnetworkoffering)
-
+                if listnetworkofferingresponse == FAILED:
+                    self.tcRunLogger.\
+                        exception("==== ListNetworkOfferingResponse "
+                                  "Failed=====")
+                    exit(1)
                 networkcmd = createNetwork.createNetworkCmd()
                 networkcmd.displaytext = "Shared SG enabled network"
                 networkcmd.name = "Shared SG enabled network"
@@ -455,7 +583,16 @@ class deployDataCenters(object):
                     networkcmd.vlan = iprange.vlan
 
                 networkcmdresponse = self.apiClient.createNetwork(networkcmd)
-                networkId = networkcmdresponse.id
+                if networkcmdresponse != \
+                        FAILED and networkcmdresponse.id is not None:
+                    networkId = networkcmdresponse.id
+                    self.tcRunLogger.\
+                        debug("Network Id : %s "
+                              "Created Successfully" % str(networkId))
+                else:
+                    self.tcRunLogger.\
+                        exception("====Network Creation Failed=====")
+                    exit(1)
                 self.createPods(zone.pods, zoneId, networkId)
 
             '''Note: Swift needs cache storage first'''
@@ -479,64 +616,21 @@ class deployDataCenters(object):
             return True
         return False
 
-    def registerApiKey(self):
-        listuser = listUsers.listUsersCmd()
-        listuser.account = "admin"
-        listuserRes = self.testClient.getApiClient().listUsers(listuser)
-        userId = listuserRes[0].id
-        apiKey = listuserRes[0].apikey
-        securityKey = listuserRes[0].secretkey
-        if apiKey is None:
-            registerUser = registerUserKeys.registerUserKeysCmd()
-            registerUser.id = userId
-            registerUserRes = \
-                self.testClient.getApiClient().registerUserKeys(registerUser)
-
-            apiKey = registerUserRes.apikey
-            securityKey = registerUserRes.secretkey
-
-        self.config.mgtSvr[0].port = 8080
-        self.config.mgtSvr[0].apiKey = apiKey
-        self.config.mgtSvr[0].securityKey = securityKey
-        return apiKey, securityKey
-
-    def loadCfg(self):
-        ''' Retrieving Management Server Connection Details '''
-        mgtDetails = self.config.mgtSvr[0]
-        ''' Retrieving Database Connection Details'''
-        dbSvrDetails = self.config.dbSvr
-
-        self.testClient = \
-            cloudstackTestClient.\
-            cloudstackTestClient(mgtDetails,
-                                 dbSvrDetails,
-                                 logger=self.tcRunLogger)
-
-        if mgtDetails.apiKey is None:
-            mgtDetails.apiKey, mgtDetails.securityKey = self.registerApiKey()
-            mgtDetails.port = 8080
-            self.testClient = \
-                cloudstackTestClient.cloudstackTestClient(
-                    mgtDetails,
-                    dbSvrDetails,
-                    logger=self.tcRunLogger)
-
+    def setClient(self):
         self.apiClient = self.testClient.getApiClient()
-        """set hypervisor"""
-        if mgtDetails.hypervisor:
-            self.apiClient.hypervisor = mgtDetails.hypervisor
-        else:
-            self.apiClient.hypervisor = "XenServer"  # Defaults to Xenserver
 
     def updateConfiguration(self, globalCfg):
-        if globalCfg is None:
+        if globalCfg is None or self.apiClient is None:
             return None
 
         for config in globalCfg:
             updateCfg = updateConfiguration.updateConfigurationCmd()
             updateCfg.name = config.name
             updateCfg.value = config.value
-            self.apiClient.updateConfiguration(updateCfg)
+            if self.apiClient.updateConfiguration(updateCfg) == FAILED:
+                self.tcRunLogger.\
+                    exception("===UpdateConfiguration Failed===")
+                exit(1)
 
     def copyAttributesToCommand(self, source, command):
         map(lambda attr: setattr(command, attr, getattr(source, attr, None)),
@@ -548,28 +642,61 @@ class deployDataCenters(object):
             return
         command = addS3.addS3Cmd()
         self.copyAttributesToCommand(s3, command)
-        self.apiClient.addS3(command)
+        if self.apiClient.addS3(command) == FAILED:
+            self.tcRunLogger.exception("====AddS3 Failed===")
+            exit(1)
 
     def deploy(self):
-        self.loadCfg()
-        self.updateConfiguration(self.config.globalConfig)
-        self.createZones(self.config.zones)
-        self.configureS3(self.config.s3)
+        try:
+            self.setClient()
+            self.updateConfiguration(self.config.globalConfig)
+            self.createZones(self.config.zones)
+            self.configureS3(self.config.s3)
+            return SUCCESS
+        except Exception, e:
+            print "\nException Occurred Under deploy :%s" % \
+                  GetDetailExceptionInfo(e)
+            return FAILED
 
 if __name__ == "__main__":
     parser = OptionParser()
     parser.add_option("-i", "--input", action="store",
-                      default="./datacenterCfg", dest="input", help="the path \
+                      default="./datacenterCfg", dest="input",
+                      help="the path \
                       where the json config file generated, by default is \
                       ./datacenterCfg")
 
     (options, args) = parser.parse_args()
-    from marvin.marvinLog import MarvinLog
-    cfg = configGenerator.getSetupConfig(options.input)
-    log_obj = MarvinLog("CSLog")
-    tcRunLogger = log_obj.setLogHandler("/tmp/debug.log")
-    deploy = deployDataCenters(cfg, tcRunLogger)
-    deploy.deploy()
+    if options.input:
+        '''
+        Imports the Modules Required
+        '''
+        from marvin.marvinLog import MarvinLog
+        from marvin.cloudstackTestClient import CSTestClient
+
+        cfg = configGenerator.getSetupConfig(options.input)
+        log_obj = MarvinLog("CSLog")
+        tcRunLogger = log_obj.setLogHandler("/tmp/debug.log")
+        if tcRunLogger is None:
+            print "\nLogger Creation Failed. " \
+                  "Please Check"
+            exit(1)
+        else:
+            print "\nAll Logs Are Available " \
+                  "Under /tmp/debug.log File"
+        obj_tc_client = CSTestClient(cfg.mgtSvr[0], cfg.dbSvr,
+                                     logger=tcRunLogger)
+        if obj_tc_client is not None and obj_tc_client.CreateTestClient() \
+                != FAILED:
+            deploy = DeployDataCenters(obj_tc_client, cfg, tcRunLogger)
+            if deploy.deploy() == FAILED:
+                print "\nDeploy DC Failed"
+                exit(1)
+        else:
+            print "\nTestClient Creation Failed. Please Check"
+            exit(1)
+    else:
+        print "\n Please Specify a Valid Configuration File"
 
     """
     create = createStoragePool.createStoragePoolCmd()

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/93932756/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 550de1a..c16339b 100644
--- a/tools/marvin/marvin/integration/lib/common.py
+++ b/tools/marvin/marvin/integration/lib/common.py
@@ -68,6 +68,10 @@ from marvin.integration.lib.utils import (get_process_status,
 
 from marvin.sshClient import SshClient
 import random
+from utils import *
+from base import *
+from marvin.codes import PASS
+from marvin.integration.lib.utils import validateList
 
 #Import System modules
 import time
@@ -140,110 +144,155 @@ def add_netscaler(apiclient, zoneid, NSservice):
 
     return netscaler
 
-def get_region(apiclient, services=None):
-    "Returns a default region"
-
+def get_region(apiclient, region_id=None, region_name=None):
+    '''
+    @name : get_region
+    @Desc : Returns the Region Information for a given region  id or region name
+    @Input : region_name: Name of the Region
+             region_id : Id of the region
+    @Output : 1. Region  Information for the passed inputs else first Region
+              2. FAILED In case the cmd failed
+    '''
+    if region_id is None and region_name is None:
+        return FAILED
     cmd = listRegions.listRegionsCmd()
-    if services:
-        if "regionid" in services:
-            cmd.id = services["regionid"]
-
-    regions = apiclient.listRegions(cmd)
-
-    if isinstance(regions, list):
-        assert len(regions) > 0
-        return regions[0]
-    else:
-        raise Exception("Failed to find specified region.")
-
-def get_domain(apiclient, services=None):
-    "Returns a default domain"
-
+    if region_name is not None:
+        cmd.name = region_name
+    if region_id is not None:
+        cmd.id = region_id
+    cmd_out = apiclient.listRegions(cmd)
+    return FAILED if validateList(cmd_out)[0] != PASS
+    return cmd_out
+
+
+def get_domain(apiclient, domain_id=None, domain_name=None):
+    '''
+    @name : get_domain
+    @Desc : Returns the Domain Information for a given domain id or domain name
+    @Input : domain id : Id of the Domain
+             domain_name : Name of the Domain
+    @Output : 1. Domain  Information for the passed inputs else first Domain
+              2. FAILED In case the cmd failed
+    '''
     cmd = listDomains.listDomainsCmd()
-    if services:
-        if "domainid" in services:
-            cmd.id = services["domainid"]
-
-    domains = apiclient.listDomains(cmd)
-
-    if isinstance(domains, list):
-        assert len(domains) > 0
-        return domains[0]
-    else:
-        raise Exception("Failed to find specified domain.")
-
-
-def get_zone(apiclient, services=None):
-    "Returns a default zone"
 
+    if domain_name is not None:
+        cmd.name = domain_name
+    if domain_id is not None:
+        cmd.id = domain_id
+    cmd_out = apiclient.listRegions(cmd)
+    return FAILED if validateList(cmd_out)[0] != PASS
+    return cmd_out
+
+
+def get_zone(apiclient, zone_name=None, zone_id=None):
+    '''
+    @name : get_zone
+    @Desc :Returns the Zone Information for a given zone id or Zone Name
+    @Input : zone_name: Name of the Zone
+             zone_id : Id of the zone
+    @Output : 1. Zone Information for the passed inputs else first zone
+              2. FAILED In case the cmd failed
+    '''
     cmd = listZones.listZonesCmd()
-    if services:
-        if "zoneid" in services:
-            cmd.id = services["zoneid"]
-
-    zones = apiclient.listZones(cmd)
-
-    if isinstance(zones, list):
-        assert len(zones) > 0, "There are no available zones in the deployment"
-        return zones[0]
+    if zone_name is not None:
+        cmd.name = zone_name
+    if zone_id is not None:
+        cmd.id = zone_id
+
+    cmd_out = apiclient.listZones(cmd)
+
+    return FAILED if (validateList(cmd_out)[0] != PASS)
+    '''
+    Check if input zone name and zone id is None,
+    then return first element of List Zones command
+    '''
+    if ( zone_name is None and zone_id is None ) 
+        return cmd_out[0]
     else:
-        raise Exception("Failed to find specified zone.")
+        return cmd_out
 
 
-def get_pod(apiclient, zoneid, services=None):
-    "Returns a default pod for specified zone"
 
+def get_pod(apiclient, pod_id=None, pod_name=None, zone_id=None):
+    '''
+    @name : get_pod
+    @Desc :  Returns the Pod Information for a given zone id or Zone Name
+    @Input : pod_name : Name of the Pod
+             pod_id : Id of the Pod
+             zone_id: Id of the Zone
+    @Output : 1. Pod Information for the pod
+              2. FAILED In case the cmd failed
+    '''
     cmd = listPods.listPodsCmd()
-    cmd.zoneid = zoneid
-
-    if services:
-        if "podid" in services:
-            cmd.id = services["podid"]
-
-    pods = apiclient.listPods(cmd)
-
-    if isinstance(pods, list):
-        assert len(pods) > 0, "No pods found for zone %s"%zoneid
-        return pods[0]
-    else:
-        raise Exception("Exception: Failed to find specified pod.")
-
-
-def get_template(apiclient, zoneid, ostype, services=None,
-                 templatefilter='featured',
-                 templatetype='BUILTIN'):
-    "Returns a template"
 
+    if pod_name is not None:
+        cmd.name = pod_name
+    if pod_id is not None:
+        cmd.id = pod_id
+    if zone_id is not None:
+        cmd.zoneid = zone_id
+
+    cmd_out = apiclient.listPods(cmd)
+
+    return FAILED if ( validateList(cmd_out)[0] != PASS )
+    return cmd_out
+
+
+def get_template(apiclient, template_id=None, template_name=None, account=None, template_type='BUILTIN'
+                 domain_id=None, zone_id=None, project_id=None,
+                 hypervisor=None, ostype_desc=None, template_filter="featured"):
+    '''
+    @Name : get_template
+    @Desc : Retrieves the template Information based upon inputs provided
+            Template is retrieved based upon either of the inputs matched 
+            condition
+    @Input : returns a template"
+    @Output : FAILED in case of any failure
+              template Information matching the inputs
+    '''
+
+    '''
+    Get OS TypeID First based upon ostype_desc
+    '''
     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 = templatefilter
-    cmd.zoneid = zoneid
-
-    if services:
-        if "template" in services:
-            cmd.id = services["template"]
-
-    list_templates = apiclient.listTemplates(cmd)
-
-    if isinstance(list_templates, list):
-        assert len(list_templates) > 0, "received empty response on template of type %s"%ostype
-        for template in list_templates:
-            if template.ostypeid == ostypeid and template.isready and template.templatetype == templatetype:
-                return template
+    cmd.description = ostype_desc
+    ostypes_out = apiclient.listOsTypes(cmd)
+
+    return FAILED if (validateList(ostypes_out)[0] != PASS )
+
+    ostype_id = ostypes_out[0].id
+
+    listcmd = listTemplates.listTemplatesCmd()
+    cmd.templatefilter = template_filter
+    if domain_id is not None:
+        cmd.domainid = domain_id
+    if zone_id is not None:
+        cmd.zoneid = zone_id
+    if template_id is not None:
+        cmd.id = template_id
+    if template_name is not None:
+        cmd.name = template_name
+    if hypervisor is not None:
+        cmd.hypervisor = hypervisor
+    if project_id is not None:
+        cmd.projectid = project_id
+    if account is not None:
+        cmd.account = account
 
-    raise Exception("Exception: Failed to find template of type %s with OSTypeID and which is in "
-                                "ready state: %s" %(templatetype, ostypeid))
-    return
+    '''
+    Get the Templates pertaining
+    '''
+    list_templatesout = apiclient.listTemplates(cmd)
+    return FAILED if validateList(list_templatesout)[0] != PASS
 
+    for template in list_templatesout:
+        if template.ostypeid == ostype_id and template.isready and template.templatetype == template_type:
+            return template
+    '''
+    Return Failed if None of the templates matched
+    '''
+    return FAILED
 
 def download_systemplates_sec_storage(server, services):
     """Download System templates on sec storage"""
@@ -251,13 +300,13 @@ def download_systemplates_sec_storage(server, services):
     try:
         # Login to management server
         ssh = SshClient(
-                                          server["ipaddress"],
-                                          server["port"],
-                                          server["username"],
-                                          server["password"]
-                             )
+                        server["ipaddress"],
+                        server["port"],
+                        server["username"],
+                        server["password"]
+                       )
     except Exception:
-        raise Exception("SSH access failted for server with IP address: %s" %
+        raise Exception("SSH access failed for server with IP address: %s" %
                                                             server["ipaddess"])
     # Mount Secondary Storage on Management Server
     cmds = [

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/93932756/tools/marvin/marvin/jsonHelper.py
----------------------------------------------------------------------
diff --git a/tools/marvin/marvin/jsonHelper.py b/tools/marvin/marvin/jsonHelper.py
index ae40b8d..f7db5ba 100644
--- a/tools/marvin/marvin/jsonHelper.py
+++ b/tools/marvin/marvin/jsonHelper.py
@@ -145,7 +145,7 @@ def getResultObj(returnObj, responsecls=None):
         errMsg = "errorCode: %s, errorText:%s" % (result.errorcode,
                                                   result.errortext)
         respname = responseName.replace("response", "")
-        raise cloudstackException.cloudstackAPIException(respname, errMsg)
+        raise cloudstackException.CloudstackAPIException(respname, errMsg)
 
     if result.count is not None:
         for key in result.__dict__.iterkeys():
@@ -247,7 +247,7 @@ due to missing parameter jobid"
 }'''
     try:
         asynJob = getResultObj(result)
-    except cloudstackException.cloudstackAPIException, e:
+    except cloudstackException.CloudstackAPIException, e:
         print e
 
     result = '{ "queryasyncjobresultresponse" : {}  }'

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/93932756/tools/marvin/marvin/lib/__init__.py
----------------------------------------------------------------------
diff --git a/tools/marvin/marvin/lib/__init__.py b/tools/marvin/marvin/lib/__init__.py
new file mode 100644
index 0000000..e69de29

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/93932756/tools/marvin/marvin/marvinInit.py
----------------------------------------------------------------------
diff --git a/tools/marvin/marvin/marvinInit.py b/tools/marvin/marvin/marvinInit.py
index f722058..36d907e 100644
--- a/tools/marvin/marvin/marvinInit.py
+++ b/tools/marvin/marvin/marvinInit.py
@@ -17,7 +17,7 @@
 '''
 @Desc: Initializes the marvin and does required prerequisites
 for starting it.
-1. Parses the configuration file passed to marvin and creates a
+   1. Parses the configuration file passed to marvin and creates a
    parsed config
    2. Initializes the logging required for marvin.All logs are
    now made available under a single timestamped folder.
@@ -28,8 +28,11 @@ for starting it.
 from marvin import configGenerator
 from marvin import cloudstackException
 from marvin.marvinLog import MarvinLog
-from marvin.deployDataCenter import deployDataCenters
+from marvin.deployDataCenter import DeployDataCenters
+from marvin.cloudstackTestClient import CSTestClient
+from marvin.cloudstackException import GetDetailExceptionInfo
 from marvin.codes import(
+    PASS,
     YES,
     NO,
     SUCCESS,
@@ -41,17 +44,26 @@ import os
 import logging
 import string
 import random
+from sys import exit
+from marvin.codegenerator import CodeGenerator
 
 
 class MarvinInit:
-    def __init__(self, config_file, load_flag, log_folder_path=None):
+    def __init__(self, config_file, load_api_flag=None,
+                 deploy_dc_flag=None,
+                 test_module_name=None,
+                 zone=None):
         self.__configFile = config_file
-        self.__loadFlag = load_flag
+        self.__deployFlag = deploy_dc_flag
+        self.__loadApiFlag = load_api_flag
         self.__parsedConfig = None
-        self.__logFolderPath = log_folder_path
+        self.__logFolderPath = None
         self.__tcRunLogger = None
         self.__testClient = None
-        self.__tcRunDebugFile = None
+        self.__tcResultFile = None
+        self.__testModuleName = test_module_name
+        self.__testDataFilePath = None
+        self.__zoneForTests = None
 
     def __parseConfig(self):
         '''
@@ -59,12 +71,15 @@ class MarvinInit:
         the parsed configuration
         '''
         try:
+            if self.__configFile is None:
+                return FAILED
             self.__parsedConfig = configGenerator.\
                 getSetupConfig(self.__configFile)
             return SUCCESS
         except Exception, e:
-            print "\n Exception Occurred Under __parseConfig : %s" % str(e)
-            return None
+            print "\nException Occurred Under __parseConfig : " \
+                  "%s" % GetDetailExceptionInfo(e)
+            return FAILED
 
     def getParsedConfig(self):
         return self.__parsedConfig
@@ -79,10 +94,14 @@ class MarvinInit:
         return self.__tcRunLogger
 
     def getDebugFile(self):
-        return self.__tcRunDebugFile
+        if self.__logFolderPath is None:
+            self.__tcResultFile = open(self.__logFolderPath +
+                                       "/results.txt", "w")
+            return self.__tcResultFile
 
     def init(self):
         '''
+        @Name : init
         @Desc :Initializes the marvin by
                1. Parsing the configuration and creating a parsed config
                   structure
@@ -91,14 +110,18 @@ class MarvinInit:
                3. Creates the DataCenter based upon configuration provided
         '''
         try:
-            if ((self.__parseConfig() is not None) and
-               (self.__initLogging() is not None) and
-               (self.__deployDC() is not None)):
+            if ((self.__parseConfig() != FAILED) and
+               (self.__setTestDataPath() != FAILED) and
+               (self.__initLogging() != FAILED) and
+               (self.__createTestClient() != FAILED) and
+               (self.__deployDC() != FAILED) and
+               (self.__loadNewApiFromXml() != FAILED)):
                 return SUCCESS
             else:
                 return FAILED
         except Exception, e:
-            print "\n Exception Occurred Under init %s" % str(e)
+            print "\n Exception Occurred Under init " \
+                  "%s" % GetDetailExceptionInfo(e)
             return FAILED
 
     def __initLogging(self):
@@ -113,57 +136,96 @@ class MarvinInit:
                      for a given test run are available under a given
                      timestamped folder
             '''
-            temp_path = "".join(str(time.time()).split("."))
-            if self.__logFolderPath is None:
-                log_config = self.__parsedConfig.logger
-                if log_config is not None:
-                    if log_config.LogFolderPath is not None:
-                        self.logFolderPath = log_config.LogFolderPath + '/' \
-                            + temp_path
-                    else:
-                        self.logFolderPath = temp_path
-                else:
-                    self.logFolderPath = temp_path
+            log_obj = MarvinLog("CSLog")
+            if log_obj is None:
+                return FAILED
             else:
-                self.logFolderPath = self.__logFolderPath + '/' + temp_path
-            if os.path.exists(self.logFolderPath):
-                self.logFolderPath += ''.join(random.choice(
-                    string.ascii_uppercase +
-                    string.digits for x in range(3)))
-            os.makedirs(self.logFolderPath)
-            '''
-            Log File Paths
-            '''
-            tc_failed_exceptionlog = self.logFolderPath + "/failed_" \
-                                                          "plus_" \
-                                                          "exceptions.txt"
-            tc_run_log = self.logFolderPath + "/runinfo.txt"
-            self.__tcRunDebugFile = open(self.logFolderPath +
-                                         "/results.txt", "w")
+                ret = log_obj.\
+                    getLogs(self.__testModuleName,
+                            self.__parsedConfig.logger)
+                if ret != FAILED:
+                    self.__logFolderPath = log_obj.getLogFolderPath()
+                    self.__tcRunLogger = log_obj.getLogger()
+            return SUCCESS
+        except Exception, e:
+            print "\n Exception Occurred Under __initLogging " \
+                  ":%s" % GetDetailExceptionInfo(e)
+            return FAILED
 
-            log_obj = MarvinLog("CSLog")
-            self.__tcRunLogger = log_obj.setLogHandler(tc_run_log)
-            log_obj.setLogHandler(tc_failed_exceptionlog,
-                                  log_level=logging.FATAL)
+    def __createTestClient(self):
+        '''
+        @Name : __createTestClient
+        @Desc : Creates the TestClient during init
+                based upon the parameters provided
+        '''
+        try:
+            mgt_details = self.__parsedConfig.mgtSvr[0]
+            dbsvr_details = self.__parsedConfig.dbSvr
+            self.__testClient = CSTestClient(mgt_details, dbsvr_details,
+                                             logger=self.__tcRunLogger,
+                                             test_data_filepath=
+                                             self.__testDataFilePath,
+                                             zone=self.__zoneForTests)
+            if self.__testClient is not None:
+                return self.__testClient.createTestClient()
+            else:
+                return FAILED
+        except Exception, e:
+            print "\n Exception Occurred Under __createTestClient : %s" % \
+                  GetDetailExceptionInfo(e)
+            return FAILED
+
+    def __loadNewApiFromXml(self):
+        try:
+            if self.__loadApiFlag:
+                apiLoadCfg = self.__parsedConfig.apiLoadCfg
+                api_dst_dir = apiLoadCfg.ParsedApiDestFolder + "/cloudstackAPI"
+                api_spec_file = apiLoadCfg.ApiSpecFile
+
+                if not os.path.exists(api_dst_dir):
+                    try:
+                        os.mkdir(api_dst_dir)
+                    except Exception, e:
+                        print "Failed to create folder %s, " \
+                              "due to %s" % (api_dst_dir,
+                                             GetDetailExceptionInfo(e))
+                        exit(1)
+                mgt_details = self.__parsedConfig.mgtSvr[0]
+                cg = CodeGenerator(api_dst_dir)
+                if os.path.exists(api_spec_file):
+                    cg.generateCodeFromXML(api_spec_file)
+                elif mgt_details is not None:
+                    endpoint_url = 'http://%s:8096/client/api?' \
+                                   'command=listApis&response=json' \
+                                   % mgt_details.mgtSvrIp
+                    cg.generateCodeFromJSON(endpoint_url)
             return SUCCESS
         except Exception, e:
-            print "\n Exception Occurred Under __initLogging :%s" % str(e)
-            return None
+            print "\n Exception Occurred Under __loadNewApiFromXml : %s" \
+                  % GetDetailExceptionInfo(e)
+            return FAILED
+
+    def __setTestDataPath(self):
+        try:
+            if ((self.__parsedConfig.TestData is not None) and
+                    (self.__parsedConfig.TestData.Path is not None)):
+                self.__testDataFilePath = self.__parsedConfig.TestData.Path
+            return SUCCESS
+        except Exception, e:
+            print "\nException Occurred Under __setTestDataPath : %s" % \
+                  GetDetailExceptionInfo(e)
+            return FAILED
 
     def __deployDC(self):
         try:
             '''
             Deploy the DataCenter and retrieves test client.
             '''
-            deploy_obj = deployDataCenters(self.__parsedConfig,
+            deploy_obj = DeployDataCenters(self.__testClient,
+                                           self.__parsedConfig,
                                            self.__tcRunLogger)
-            if self.__loadFlag:
-                deploy_obj.loadCfg()
-            else:
-                deploy_obj.deploy()
-
-            self.__testClient = deploy_obj.testClient
-            return SUCCESS
+            return deploy_obj.deploy() if self.__deployFlag else FAILED
         except Exception, e:
-            print "\n Exception Occurred Under __deployDC : %s" % str(e)
-            return None
+            print "\n Exception Occurred Under __deployDC : %s" % \
+                  GetDetailExceptionInfo(e)
+            return FAILED

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/93932756/tools/marvin/marvin/marvinLog.py
----------------------------------------------------------------------
diff --git a/tools/marvin/marvin/marvinLog.py b/tools/marvin/marvin/marvinLog.py
index 76de185..53fbc62 100644
--- a/tools/marvin/marvin/marvinLog.py
+++ b/tools/marvin/marvin/marvinLog.py
@@ -20,17 +20,20 @@
 import logging
 import sys
 import time
-from marvin.codes import (NO,
-                          YES
+import os
+from marvin.codes import (SUCCESS,
+                          FAILED
                           )
+from marvin.cloudstackException import GetDetailExceptionInfo
 
 
 class MarvinLog:
     '''
+    @Name  : MarvinLog
     @Desc  : provides interface for logging to marvin
     @Input : logger_name : name for logger
     '''
-    logFormat = logging.Formatter("%(asctime)s - %(levelname)s - %(name)s - %(message)s")
+    logFormat = logging.Formatter("%(asctime)s - %(levelname)s - %(message)s")
     _instance = None
 
     def __new__(cls, logger_name):
@@ -39,13 +42,28 @@ class MarvinLog:
             return cls._instance
 
     def __init__(self, logger_name):
-        self.loggerName = logger_name
-        self.logger = None
+        '''
+        @Name: __init__
+        @Input: logger_name for logger
+        '''
+        self.__loggerName = logger_name
+        '''
+        Logger for Logging Info
+        '''
+        self.__logger = None
+        '''
+        Log Folder Directory
+        '''
+        self.__logFolderDir = None
         self.__setLogger()
 
     def __setLogger(self):
-        self.logger = logging.getLogger(self.loggerName)
-        self.logger.setLevel(logging.DEBUG)
+        '''
+        @Name : __setLogger
+        @Desc : Sets the Logger and Level
+        '''
+        self.__logger = logging.getLogger(self.__loggerName)
+        self.__logger.setLevel(logging.DEBUG)
 
     def setLogHandler(self, log_file_path, log_format=None,
                       log_level=logging.DEBUG):
@@ -54,6 +72,7 @@ class MarvinLog:
         @Input: log_file_path: Log File Path as where to store the logs
                log_format : Format of log messages to be dumped
                log_level : Determines the level of logging for this logger
+        @Output: SUCCESS if no issues else FAILED
         '''
         try:
             if log_file_path is not None:
@@ -66,8 +85,89 @@ class MarvinLog:
             else:
                 stream.setFormatter(self.__class__.logFormat)
             stream.setLevel(log_level)
-            self.logger.addHandler(stream)
+            self.__logger.addHandler(stream)
+            return SUCCESS
+        except Exception, e:
+            print "\nException Occurred Under " \
+                  "setLogHandler %s" % GetDetailExceptionInfo(e)
+            return FAILED
+
+    def __cleanPreviousLogs(self, logfolder_to_remove):
+        '''
+        @Name : __cleanPreviousLogs
+        @Desc : Removes the Previous Logs
+        @Return: N\A
+        @Input: logfolder_to_remove: Path of Log to remove
+        '''
+        os.rmdir(logfolder_to_remove)
+
+    def getLogger(self):
+        '''
+        @Name:getLogger
+        @Desc : Returns the Logger
+        '''
+        return self.__logger
+
+    def getLogFolderPath(self):
+        '''
+        @Name : getLogFolderPath
+        @Desc : Returns the final log directory path for marvin run
+        '''
+        return self.__logFolderDir
+
+    def createLogs(self, test_module_name=None, log_cfg=None):
+        '''
+        @Name : createLogs
+        @Desc : Gets the Logger with file paths initialized and created
+        @Inputs :test_module_name: Test Module Name to use for logs while
+                 creating log folder path
+                 log_cfg: Log Configuration provided inside of
+                 Configuration
+        @Output : SUCCESS\FAILED
+        '''
+        try:
+            if log_cfg is None:
+                print "\nInvalid Log Folder Configuration." \
+                      "Please Check Config File"
+                return FAILED
+            if test_module_name is None:
+                temp_path = time.strftime("%b_%d_%Y_%H_%M_%S",
+                                          time.localtime())
+            else:
+                temp_path = test_module_name
+
+            if (('LogFolderPath' in log_cfg.__dict__.keys()) and
+                    (log_cfg.__dict__.get('LogFolderPath') is not None)):
+                self.__cleanPreviousLogs(log_cfg.
+                                         __dict__.
+                                         get('LogFolderPath') + "MarvinLogs/")
+                temp_dir = log_cfg.__dict__.get('LogFolderPath') + "MarvinLogs"
+            else:
+                temp_dir = "MarvinLogs"
+
+            self.__logFolderDir = temp_dir + temp_path
+            print "\n*********Log Folder Path: %s. " \
+                  "All logs will be available here **************" \
+                  % str(self.__logFolderDir)
+
+            os.makedirs(self.__logFolderDir)
+
+            '''
+            Log File Paths
+            1. FailedExceptionLog
+            2. RunLog contains the complete Run Information for Test Run
+            3. ResultFile contains the TC result information for Test Run
+            '''
+            tc_failed_exception_log = \
+                self.__logFolderDir + "/failed_plus_exceptions.txt"
+            tc_run_log = self.__logFolderDir + "/runinfo.txt"
+            if self.setLogHandler(tc_run_log,
+                                  log_level=logging.DEBUG) != FAILED:
+                self.setLogHandler(tc_failed_exception_log,
+                                   log_level=logging.FATAL)
+                return SUCCESS
+            return FAILED
         except Exception, e:
-            print "\n Exception Occurred Under setLogHandler %s" % str(e)
-        finally:
-            return self.logger
+            print "\n Exception Occurred Under createLogs :%s" % \
+                  GetDetailExceptionInfo(e)
+            return FAILED

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/93932756/tools/marvin/marvin/marvinPlugin.py
----------------------------------------------------------------------
diff --git a/tools/marvin/marvin/marvinPlugin.py b/tools/marvin/marvin/marvinPlugin.py
index df7d7a3..f36bca8 100644
--- a/tools/marvin/marvin/marvinPlugin.py
+++ b/tools/marvin/marvin/marvinPlugin.py
@@ -24,10 +24,8 @@ from marvin.marvinInit import MarvinInit
 from nose.plugins.base import Plugin
 from marvin.codes import (SUCCESS,
                           FAILED,
-                          EXCEPTION,
-                          UNKNOWN_ERROR
-                          )
-import traceback
+                          EXCEPTION)
+from marvin.cloudstackException import GetDetailExceptionInfo
 import time
 import os
 
@@ -43,8 +41,22 @@ class MarvinPlugin(Plugin):
         self.identifier = None
         self.testClient = None
         self.parsedConfig = None
-        self.configFile = None
-        self.loadFlag = None
+        '''
+        Contains Config File
+        '''
+        self.__configFile = None
+        '''
+        Signifies the flag whether to load new API Information
+        '''
+        self.__loadNewApiFlag = None
+        '''
+        Signifies the Zone against which all tests will be Run
+        '''
+        self.__zoneForTests = None
+        '''
+        Signifies the flag whether to deploy the New DC or Not
+        '''
+        self.__deployDcFlag
         self.conf = None
         self.debugStream = sys.stdout
         self.testRunner = None
@@ -66,14 +78,12 @@ class MarvinPlugin(Plugin):
                 return
             else:
                 self.enabled = True
-        self.configFile = options.config_file
-        self.loadFlag = options.load
-        self.logFolderPath = options.log_folder_path
+
+        self.__configFile = options.config_file
+        self.__loadNewApiFlag = options.loadNewApiFlag
+        self.__deployDcFlag = options.deployDc
+        self.__zoneForTests = options.zone
         self.conf = conf
-        '''
-        Initializes the marvin with required settings
-        '''
-        self.startMarvin()
 
     def options(self, parser, env):
         """
@@ -83,19 +93,31 @@ class MarvinPlugin(Plugin):
                           default=env.get('MARVIN_CONFIG',
                                           './datacenter.cfg'),
                           dest="config_file",
-                          help="Marvin's configuration file where the " +
-                               "datacenter information is specified" +
-                               " [MARVIN_CONFIG]")
-        parser.add_option("--load", action="store_true",
+                          help="Marvin's configuration file is required."
+                               "The config file containing the datacenter and "
+                               "other management server "
+                               "information is specified")
+        parser.add_option("--deploy-dc", action="store_true",
                           default=False,
-                          dest="load",
-                          help="Only load the deployment configuration given")
-        parser.add_option("--log-folder-path",
-                          action="store",
+                          dest="deployDc",
+                          help="Deploys the DC with Given Configuration."
+                               "Requires only when DC needs to be deployed")
+        parser.add_option("--zone", action="zone_tests",
                           default=None,
-                          dest="log_folder_path",
-                          help="Path to the folder "
-                               "where log files will be stored")
+                          dest="zone",
+                          help="Runs all tests against this specified zone")
+        parser.add_option("--load-new-apis", action="store_true",
+                          default=False,
+                          dest="loadNewApiFlag",
+                          help="Loads the New Apis with Given Api Xml File."
+                               "Creates the new Api's from commands.xml File")
+        '''
+        Check if the configuration file is not valid,print and exit
+        '''
+        (options, args) = parser.parse_args()
+        if options.config_file is None:
+            parser.print_usage()
+            sys.exit(1)
         Plugin.options(self, parser, env)
 
     def wantClass(self, cls):
@@ -105,16 +127,44 @@ class MarvinPlugin(Plugin):
             return True
         return None
 
+    def prepareTest(self, test):
+        '''
+        @Desc : Initializes the marvin with required settings
+        '''
+        test_module_name = test.__str__()
+        if self.startMarvin(test_module_name) == FAILED:
+            print "Starting Marvin FAILED. Please Check Config and " \
+                  "Arguments Supplied"
+
+    def __checkImport(self, filename):
+        '''
+        @Desc : Verifies to Import the test Module before running and check
+                whether if it is importable.
+                This will check for test modules which has some issues to be
+                getting imported.
+                Returns False or True based upon the result.
+        '''
+        try:
+            __import__(filename)
+            return True
+        except ImportError, e:
+            self.tcRunLogger.exception("Module : %s Import "
+                                       "Failed Reason :%s"
+                                       % (filename, GetDetailExceptionInfo(e)))
+            return False
+
     def wantFile(self, filename):
         '''
-        Only python files will be used as test modules
+        @Desc : Only python files will be used as test modules
         '''
+        if filename is None or filename == '':
+            return False
         parts = filename.split(os.path.sep)
         base, ext = os.path.splitext(parts[-1])
-        if ext == '.py':
-            return True
-        else:
+        if ext != '.py':
             return False
+        else:
+            return self.__checkImport(filename)
 
     def loadTestsFromTestCase(self, cls):
         if cls.__name__ != 'cloudstackTestCase':
@@ -134,24 +184,15 @@ class MarvinPlugin(Plugin):
         Currently used to record start time for tests
         Dump Start Msg of TestCase to Log
         """
-        self.tcRunLogger.debug("::::::::::::STARTED : TC: " +
+        self.tcRunLogger.debug("\n\n::::::::::::STARTED : TC: " +
                                str(self.testName) + " :::::::::::")
         self.startTime = time.time()
 
-    def getErrorInfo(self, err):
-        '''
-        Extracts and returns the sanitized error message
-        '''
-        if err is not None:
-            return str(traceback.format_exc())
-        else:
-            return UNKNOWN_ERROR
-
     def handleError(self, test, err):
         '''
         Adds Exception throwing test cases and information to log.
         '''
-        err_msg = self.getErrorInfo(err)
+        err_msg = GetDetailExceptionInfo(err)
         self.tcRunLogger.fatal("%s: %s: %s" %
                                (EXCEPTION, self.testName, err_msg))
         self.testResult = EXCEPTION
@@ -160,12 +201,12 @@ class MarvinPlugin(Plugin):
         '''
         Adds Failing test cases and information to log.
         '''
-        err_msg = self.getErrorInfo(err)
+        err_msg = GetDetailExceptionInfo(err)
         self.tcRunLogger.fatal("%s: %s: %s" %
                                (FAILED, self.testName, err_msg))
         self.testResult = FAILED
 
-    def startMarvin(self):
+    def startMarvin(self, test_module_name):
         '''
         Initializes the Marvin
         creates the test Client
@@ -174,9 +215,11 @@ class MarvinPlugin(Plugin):
         Creates a debugstream for tc debug log
         '''
         try:
-            obj_marvininit = MarvinInit(self.configFile,
-                                        self.loadFlag,
-                                        self.logFolderPath)
+            obj_marvininit = MarvinInit(self.__configFile,
+                                        self.__loadNewApiFlag,
+                                        self.__deployDcFlag,
+                                        test_module_name,
+                                        self.__zoneForoTests)
             if obj_marvininit.init() == SUCCESS:
                 self.testClient = obj_marvininit.getTestClient()
                 self.tcRunLogger = obj_marvininit.getLogger()
@@ -191,7 +234,8 @@ class MarvinPlugin(Plugin):
             else:
                 return FAILED
         except Exception, e:
-            print "Exception Occurred under startMarvin: %s" % str(e)
+            print "Exception Occurred under startMarvin: %s" % \
+                  GetDetailExceptionInfo(e)
             return FAILED
 
     def stopTest(self, test):
@@ -221,5 +265,6 @@ class MarvinPlugin(Plugin):
         setattr(test, "clstestclient", self.testClient)
         if hasattr(test, "user"):
             # when the class-level attr applied. all test runs as 'user'
-            self.testClient.createUserApiClient(test.UserName, test.DomainName,
-                                                test.AcctType)
+            self.testClient.getUserApiClient(test.UserName,
+                                             test.DomainName,
+                                             test.AcctType)

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/93932756/tools/marvin/marvin/src/__init__.py
----------------------------------------------------------------------
diff --git a/tools/marvin/marvin/src/__init__.py b/tools/marvin/marvin/src/__init__.py
new file mode 100644
index 0000000..e69de29

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/93932756/tools/marvin/marvin/tcExecuteEngine.py
----------------------------------------------------------------------
diff --git a/tools/marvin/marvin/tcExecuteEngine.py b/tools/marvin/marvin/tcExecuteEngine.py
index f959e7e..c437337 100644
--- a/tools/marvin/marvin/tcExecuteEngine.py
+++ b/tools/marvin/marvin/tcExecuteEngine.py
@@ -61,9 +61,10 @@ class TestCaseExecuteEngine(object):
                 setattr(test.__class__, "clstestclient", self.testclient)
                 if hasattr(test, "user"):
                     # attribute when test is entirely executed as user
-                    self.testclient.createUserApiClient(test.UserName,
-                                                        test.DomainName,
-                                                        test.AcctType)
+                    self.testclient.\
+                        getUserApiClient(test.UserName,
+                                         test.DomainName,
+                                         test.AcctType)
 
     def run(self):
         if self.suite:


[3/4] CLOUDSTACK-5925: Moved test data from testsuites to marvin/config

Posted by gi...@apache.org.
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/6a2cc9fb/test/integration/smoke/test_snapshots.py
----------------------------------------------------------------------
diff --git a/test/integration/smoke/test_snapshots.py b/test/integration/smoke/test_snapshots.py
index 6ee7c62..1d711db 100644
--- a/test/integration/smoke/test_snapshots.py
+++ b/test/integration/smoke/test_snapshots.py
@@ -22,112 +22,14 @@ from marvin.integration.lib.utils import *
 from marvin.integration.lib.base import *
 from marvin.integration.lib.common import *
 
-class Services:
-    """Test Snapshots Services
-    """
-
-    def __init__(self):
-        self.services = {
-                        "account": {
-                                    "email": "test@test.com",
-                                    "firstname": "Test",
-                                    "lastname": "User",
-                                    "username": "test",
-                                    # Random characters are appended for unique
-                                    # username
-                                    "password": "password",
-                         },
-                         "service_offering": {
-                                    "name": "Tiny Instance",
-                                    "displaytext": "Tiny Instance",
-                                    "cpunumber": 1,
-                                    "cpuspeed": 200,    # in MHz
-                                    "memory": 256,      # In MBs
-                        },
-                        "disk_offering": {
-                                    "displaytext": "Small Disk",
-                                    "name": "Small Disk",
-                                    "disksize": 1
-                        },
-                        "server_with_disk":
-                                    {
-                                        "displayname": "Test VM -With Disk",
-                                        "username": "root",
-                                        "password": "password",
-                                        "ssh_port": 22,
-                                        "hypervisor": 'XenServer',
-                                        "privateport": 22,
-                                        "publicport": 22,
-                                        "protocol": 'TCP',
-                                },
-
-                        "server_without_disk":
-                                    {
-                                        "displayname": "Test VM-No Disk",
-                                        "username": "root",
-                                        "password": "password",
-                                        "ssh_port": 22,
-                                        "hypervisor": 'XenServer',
-                                        "privateport": 22,
-                                        # For NAT rule creation
-                                        "publicport": 22,
-                                        "protocol": 'TCP',
-                                },
-                        "server": {
-                                    "displayname": "TestVM",
-                                    "username": "root",
-                                    "password": "password",
-                                    "ssh_port": 22,
-                                    "hypervisor": 'XenServer',
-                                    "privateport": 22,
-                                    "publicport": 22,
-                                    "protocol": 'TCP',
-                                },
-                         "mgmt_server": {
-                                    "ipaddress": '192.168.100.21',
-                                    "username": "root",
-                                    "password": "password",
-                                    "port": 22,
-                                },
-                        "recurring_snapshot": {
-                                    "intervaltype": 'HOURLY',
-                                    # Frequency of snapshots
-                                    "maxsnaps": 1,  # Should be min 2
-                                    "schedule": 1,
-                                    "timezone": 'US/Arizona',
-                                    # Timezone Formats - http://cloud.mindtouch.us/CloudStack_Documentation/Developer's_Guide%3A_CloudStack
-                                },
-                        "templates": {
-                                    "displaytext": 'Template',
-                                    "name": 'Template',
-                                    "ostype": "CentOS 5.3 (64-bit)",
-                                    "templatefilter": 'self',
-                                },
-                        "volume": {
-                                   "diskname": "APP Data Volume",
-                                   "size": 1,   # in GBs
-                                   "diskdevice": ['/dev/xvdb', '/dev/sdb', '/dev/hdb', '/dev/vdb' ],   # Data Disk
-                        },
-                        "paths": {
-                                    "mount_dir": "/mnt/tmp",
-                                    "sub_dir": "test",
-                                    "sub_lvl_dir1": "test1",
-                                    "sub_lvl_dir2": "test2",
-                                    "random_data": "random.data",
-                        },
-                        "ostype": "CentOS 5.3 (64-bit)",
-                        # Cent OS 5.3 (64 bit)
-                        "sleep": 60,
-                        "timeout": 10,
-                    }
-
-
 class TestSnapshotRootDisk(cloudstackTestCase):
 
     @classmethod
     def setUpClass(cls):
-        cls.api_client = super(TestSnapshotRootDisk, cls).getClsTestClient().getApiClient()
-        cls.services = Services().services
+        cloudstackTestClient = super(TestSnapshotRootDisk, cls).getClsTestClient()
+        cls.api_client = cloudstackTestClient.getApiClient()
+        cls.services = cloudstackTestClient.getConfigParser().parsedDict
+
         # Get Zone, Domain and templates
         cls.domain = get_domain(cls.api_client, cls.services)
         cls.zone = get_zone(cls.api_client, cls.services)
@@ -154,7 +56,7 @@ class TestSnapshotRootDisk(cloudstackTestCase):
 
         cls.service_offering = ServiceOffering.create(
                                             cls.api_client,
-                                            cls.services["service_offering"]
+                                            cls.services["service_offerings"]
                                             )
         cls.virtual_machine = cls.virtual_machine_with_disk = \
                     VirtualMachine.create(

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/6a2cc9fb/test/integration/smoke/test_ssvm.py
----------------------------------------------------------------------
diff --git a/test/integration/smoke/test_ssvm.py b/test/integration/smoke/test_ssvm.py
index a2b9eab..c056746 100644
--- a/test/integration/smoke/test_ssvm.py
+++ b/test/integration/smoke/test_ssvm.py
@@ -31,16 +31,6 @@ import telnetlib
 import time
 _multiprocess_shared_ = True
 
-class Services:
-    """Test SSVM Services
-    """
-
-    def __init__(self):
-        self.services = {
-                       "sleep": 60,
-                       "timeout": 10,
-                      }
-
 class TestSSVMs(cloudstackTestCase):
 
     def setUp(self):

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/6a2cc9fb/test/integration/smoke/test_templates.py
----------------------------------------------------------------------
diff --git a/test/integration/smoke/test_templates.py b/test/integration/smoke/test_templates.py
index e371ad4..65b4f35 100644
--- a/test/integration/smoke/test_templates.py
+++ b/test/integration/smoke/test_templates.py
@@ -32,72 +32,6 @@ import datetime
 
 _multiprocess_shared_ = True
 
-class Services:
-    """Test Templates Services
-    """
-
-    def __init__(self):
-        self.services = {
-                        "account": {
-                                    "email": "test@test.com",
-                                    "firstname": "Test",
-                                    "lastname": "User",
-                                    "username": "test",
-                                    # Random characters are appended for unique
-                                    # username
-                                    "password": "password",
-                         },
-                         "service_offering": {
-                                    "name": "Tiny Instance",
-                                    "displaytext": "Tiny Instance",
-                                    "cpunumber": 1,
-                                    "cpuspeed": 100,    # in MHz
-                                    "memory": 128,       # In MBs
-                        },
-                        "disk_offering": {
-                                    "displaytext": "Small",
-                                    "name": "Small",
-                                    "disksize": 1
-                        },
-                        "virtual_machine": {
-                                    "displayname": "testVM",
-                                    "hypervisor": 'XenServer',
-                                    "protocol": 'TCP',
-                                    "ssh_port": 22,
-                                    "username": "root",
-                                    "password": "password",
-                                    "privateport": 22,
-                                    "publicport": 22,
-                         },
-                        "volume": {
-                                "diskname": "Test Volume",
-                                 },
-                         "template_1": {
-                                "displaytext": "Cent OS Template",
-                                "name": "Cent OS Template",
-                                "ostype": "CentOS 5.3 (64-bit)",
-                         },
-                         "template_2": {
-                                "displaytext": "Public Template",
-                                "name": "Public template",
-                                "ostype": "CentOS 5.3 (64-bit)",
-                                "isfeatured": True,
-                                "ispublic": True,
-                                "isextractable": True,
-                                "mode": "HTTP_DOWNLOAD",
-                         },
-                        "templatefilter": 'self',
-                        "isfeatured": True,
-                        "ispublic": True,
-                        "isextractable": False,
-                        "bootable": True,
-                        "passwordenabled": True,
-                        "ostype": "CentOS 5.3 (64-bit)",
-                        "sleep": 30,
-                        "timeout": 10,
-                     }
-
-
 class TestCreateTemplate(cloudstackTestCase):
 
     def setUp(self):
@@ -118,8 +52,10 @@ class TestCreateTemplate(cloudstackTestCase):
 
     @classmethod
     def setUpClass(cls):
-        cls.services = Services().services
-        cls.api_client = super(TestCreateTemplate, cls).getClsTestClient().getApiClient()
+        
+        cloudstackTestClient = super(TestCreateTemplate, cls).getClsTestClient()
+        cls.api_client = cloudstackTestClient.getApiClient()
+        cls.services = cloudstackTestClient.getConfigParser().parsedDict
 
         # Get Zone, Domain and templates
         cls.domain = get_domain(cls.api_client, cls.services)
@@ -134,7 +70,7 @@ class TestCreateTemplate(cloudstackTestCase):
                             cls.zone.id,
                             cls.services["ostype"]
                             )
-        cls.services["template_1"]["ostypeid"] = template.ostypeid
+        cls.services["template"]["ostypeid"] = template.ostypeid
         cls.services["template_2"]["ostypeid"] = template.ostypeid
         cls.services["ostypeid"] = template.ostypeid
 
@@ -152,7 +88,7 @@ class TestCreateTemplate(cloudstackTestCase):
 
         cls.service_offering = ServiceOffering.create(
                                             cls.api_client,
-                                            cls.services["service_offering"]
+                                            cls.services["service_offerings"]
                                             )
         #create virtual machine
         cls.virtual_machine = VirtualMachine.create(
@@ -233,7 +169,7 @@ class TestCreateTemplate(cloudstackTestCase):
         #Create template from Virtual machine and Volume ID
         template = Template.create(
                                 self.apiclient,
-                                self.services["template_1"],
+                                self.services["template"],
                                 self.volume.id,
                                 account=self.account.name,
                                 domainid=self.account.domainid
@@ -264,18 +200,18 @@ class TestCreateTemplate(cloudstackTestCase):
 
         self.assertEqual(
                             template_response.displaytext,
-                            self.services["template_1"]["displaytext"],
+                            self.services["template"]["displaytext"],
                             "Check display text of newly created template"
                         )
         name = template_response.name
         self.assertEqual(
-                            name.count(self.services["template_1"]["name"]),
+                            name.count(self.services["template"]["name"]),
                             1,
                             "Check name of newly created template"
                         )
         self.assertEqual(
                             template_response.ostypeid,
-                            self.services["template_1"]["ostypeid"],
+                            self.services["template"]["ostypeid"],
                             "Check osTypeID of newly created template"
                         )
         return
@@ -286,8 +222,9 @@ class TestTemplates(cloudstackTestCase):
     @classmethod
     def setUpClass(cls):
 
-        cls.services = Services().services
-        cls.api_client = super(TestTemplates, cls).getClsTestClient().getApiClient()
+        cloudstackTestClient = super(TestTemplates, cls).getClsTestClient()
+        cls.api_client = cloudstackTestClient.getApiClient()
+        cls.services = cloudstackTestClient.getConfigParser().parsedDict
 
         # Get Zone, Domain and templates
         cls.domain = get_domain(cls.api_client, cls.services)
@@ -314,7 +251,7 @@ 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"]["ostypeid"] = template.ostypeid
         cls.services["template_2"]["ostypeid"] = template.ostypeid
         cls.services["ostypeid"] = template.ostypeid
 
@@ -335,7 +272,7 @@ class TestTemplates(cloudstackTestCase):
 
         cls.service_offering = ServiceOffering.create(
                                             cls.api_client,
-                                            cls.services["service_offering"]
+                                            cls.services["service_offerings"]
                                         )
         #create virtual machine
         cls.virtual_machine = VirtualMachine.create(
@@ -390,7 +327,7 @@ class TestTemplates(cloudstackTestCase):
         #Create templates for Edit, Delete & update permissions testcases
         cls.template_1 = Template.create(
                                          cls.api_client,
-                                         cls.services["template_1"],
+                                         cls.services["template"],
                                          cls.volume.id,
                                          account=cls.account.name,
                                          domainid=cls.account.domainid

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/6a2cc9fb/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 ff37c99..9afcba5 100644
--- a/test/integration/smoke/test_vm_life_cycle.py
+++ b/test/integration/smoke/test_vm_life_cycle.py
@@ -28,111 +28,15 @@ from nose.plugins.attrib import attr
 import time
 
 _multiprocess_shared_ = True
-class Services:
-    """Test VM Life Cycle Services
-    """
-
-    def __init__(self):
-        self.services = {
-                "disk_offering":{
-                    "displaytext": "Small",
-                    "name": "Small",
-                    "disksize": 1
-                },
-                "account": {
-                    "email": "test@test.com",
-                    "firstname": "Test",
-                    "lastname": "User",
-                    "username": "test",
-                    # Random characters are appended in create account to 
-                    # ensure unique username generated each time
-                    "password": "password",
-                },
-                "small":
-                # Create a small virtual machine instance with disk offering 
-                {
-                    "displayname": "testserver",
-                    "username": "root", # VM creds for SSH
-                    "password": "password",
-                    "ssh_port": 22,
-                    "hypervisor": 'XenServer',
-                    "privateport": 22,
-                    "publicport": 22,
-                    "protocol": 'TCP',
-                },
-                "medium":   # Create a medium virtual machine instance 
-                {
-                    "displayname": "testserver",
-                    "username": "root",
-                    "password": "password",
-                    "ssh_port": 22,
-                    "hypervisor": 'XenServer',
-                    "privateport": 22,
-                    "publicport": 22,
-                    "protocol": 'TCP',
-                },
-                "service_offerings":
-                {
-                 "tiny":
-                   {
-                        "name": "Tiny Instance",
-                        "displaytext": "Tiny Instance",
-                        "cpunumber": 1,
-                        "cpuspeed": 100, # in MHz
-                        "memory": 128, # In MBs
-                    },
-                 "small":
-                    {
-                     # Small service offering ID to for change VM 
-                     # service offering from medium to small
-                        "name": "Small Instance",
-                        "displaytext": "Small Instance",
-                        "cpunumber": 1,
-                        "cpuspeed": 100,
-                        "memory": 256,
-                    },
-                "medium":
-                    {
-                    # Medium service offering ID to for
-                    # change VM service offering from small to medium
-                        "name": "Medium Instance",
-                        "displaytext": "Medium Instance",
-                        "cpunumber": 1,
-                        "cpuspeed": 100,
-                        "memory": 256,
-                    }
-                },
-                "iso":  # ISO settings for Attach/Detach ISO tests
-                {
-                    "displaytext": "Test ISO",
-                    "name": "testISO",
-                    "url": "http://people.apache.org/~tsp/dummy.iso",
-                     # Source URL where ISO is located
-                    "ostype": 'CentOS 5.3 (64-bit)',
-                    "mode": 'HTTP_DOWNLOAD', # Downloading existing ISO 
-                },
-                "template": {
-                    "displaytext": "Cent OS Template",
-                    "name": "Cent OS Template",
-                    "passwordenabled": True,
-                },
-            "diskdevice": ['/dev/vdc',  '/dev/vdb', '/dev/hdb', '/dev/hdc', '/dev/xvdd', '/dev/cdrom', '/dev/sr0', '/dev/cdrom1' ],
-            # Disk device where ISO is attached to instance
-            "mount_dir": "/mnt/tmp",
-            "sleep": 60,
-            "timeout": 10,
-            #Migrate VM to hostid
-            "ostype": 'CentOS 5.3 (64-bit)',
-            # CentOS 5.3 (64-bit)
-        }
-
 
 class TestDeployVM(cloudstackTestCase):
 
     @classmethod
     def setUpClass(cls):
-        cls.services = Services().services
-        cls.apiclient = super(TestDeployVM, cls).getClsTestClient().getApiClient()
+        cloudstackTestClient = super(TestDeployVM, cls).getClsTestClient()
+        cls.api_client = cloudstackTestClient.getApiClient()
+        cls.services = cloudstackTestClient.getConfigParser().parsedDict
+
         # Get Zone, Domain and templates
         domain = get_domain(cls.apiclient, cls.services)
         cls.zone = get_zone(cls.apiclient, cls.services)
@@ -156,7 +60,7 @@ class TestDeployVM(cloudstackTestCase):
 
         cls.services["medium"]["zoneid"] = cls.zone.id
         cls.services["medium"]["template"] = template.id
-        cls.services["iso"]["zoneid"] = cls.zone.id
+        cls.services["iso1"]["zoneid"] = cls.zone.id
 
         cls.account = Account.create(
             cls.apiclient,
@@ -287,8 +191,9 @@ class TestVMLifeCycle(cloudstackTestCase):
 
     @classmethod
     def setUpClass(cls):
-        cls.api_client = super(TestVMLifeCycle, cls).getClsTestClient().getApiClient()
-        cls.services = Services().services
+        cloudstackTestClient = super(TestVMLifeCycle, cls).getClsTestClient()
+        cls.api_client = cloudstackTestClient.getApiClient()
+        cls.services = cloudstackTestClient.getConfigParser().parsedDict
 
         # Get Zone, Domain and templates
         domain = get_domain(cls.api_client, cls.services)
@@ -313,7 +218,7 @@ class TestVMLifeCycle(cloudstackTestCase):
 
         cls.services["medium"]["zoneid"] = cls.zone.id
         cls.services["medium"]["template"] = template.id
-        cls.services["iso"]["zoneid"] = cls.zone.id
+        cls.services["iso1"]["zoneid"] = cls.zone.id
 
         # Create VMs, NAT Rules etc
         cls.account = Account.create(
@@ -710,7 +615,7 @@ class TestVMLifeCycle(cloudstackTestCase):
 
         iso = Iso.create(
                          self.apiclient,
-                         self.services["iso"],
+                         self.services["iso1"],
                          account=self.account.name,
                          domainid=self.account.domainid
                          )
@@ -737,12 +642,13 @@ class TestVMLifeCycle(cloudstackTestCase):
         except Exception as e:
             self.fail("SSH failed for virtual machine: %s - %s" %
                                 (self.virtual_machine.ipaddress, e))
-
-        cmds = "mkdir -p %s" % self.services["mount_dir"]
+        
+        mount_dir = "/mnt/tmp"
+        cmds = "mkdir -p %s" % mount_dir
         self.assert_(ssh_client.execute(cmds) == [], "mkdir failed within guest")
 
         for diskdevice in self.services["diskdevice"]:
-            res = ssh_client.execute("mount -rt iso9660 {} {}".format(diskdevice, self.services["mount_dir"]))
+            res = ssh_client.execute("mount -rt iso9660 {} {}".format(diskdevice, mount_dir))
             if res == []:
                 self.services["mount"] = diskdevice
                 break
@@ -767,7 +673,7 @@ class TestVMLifeCycle(cloudstackTestCase):
 
         try:
             #Unmount ISO
-            command = "umount %s" % self.services["mount_dir"]
+            command = "umount %s" % "mount_dir
             ssh_client.execute(command)
         except Exception as e:
             self.fail("SSH failed for virtual machine: %s - %s" %

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/6a2cc9fb/test/integration/smoke/test_vm_snapshots.py
----------------------------------------------------------------------
diff --git a/test/integration/smoke/test_vm_snapshots.py b/test/integration/smoke/test_vm_snapshots.py
index b49a37c..7fc0b8f 100644
--- a/test/integration/smoke/test_vm_snapshots.py
+++ b/test/integration/smoke/test_vm_snapshots.py
@@ -24,60 +24,6 @@ from marvin.integration.lib.utils import *
 from marvin.integration.lib.base import *
 from marvin.integration.lib.common import *
 
-class Services:
-    """Test Snapshots Services
-    """
-
-    def __init__(self):
-        self.services = {
-            "account": {
-                "email": "test@test.com",
-                "firstname": "Test",
-                "lastname": "User",
-                "username": "test",
-                # Random characters are appended for unique
-                # username
-                "password": "password",
-            },
-            "service_offering": {
-                "name": "Tiny Instance",
-                "displaytext": "Tiny Instance",
-                "cpunumber": 1,
-                "cpuspeed": 200, # in MHz
-                "memory": 256, # In MBs
-            },
-            "server": {
-                "displayname": "TestVM",
-                "username": "root",
-                "password": "password",
-                "ssh_port": 22,
-                "hypervisor": 'XenServer',
-                "privateport": 22,
-                "publicport": 22,
-                "protocol": 'TCP',
-            },
-            "mgmt_server": {
-                "ipaddress": '1.2.2.152',
-                "username": "root",
-                "password": "password",
-                "port": 22,
-            },
-            "templates": {
-                "displaytext": 'Template',
-                "name": 'Template',
-                "ostype": "CentOS 5.3 (64-bit)",
-                "templatefilter": 'self',
-            },
-            "test_dir": "/tmp",
-            "random_data": "random.data",
-            "snapshot_name": "TestSnapshot",
-            "snapshot_displaytext": "Test",
-            "ostype": "CentOS 5.3 (64-bit)",
-            "sleep": 60,
-            "timeout": 10,
-            "mode": 'advanced', # Networking mode: Advanced, Basic
-        }
-
 class TestVmSnapshot(cloudstackTestCase):
 
     @classmethod
@@ -109,7 +55,7 @@ class TestVmSnapshot(cloudstackTestCase):
 
         cls.service_offering = ServiceOffering.create(
                             cls.api_client,
-                            cls.services["service_offering"]
+                            cls.services["service_offerings"]
                             )
         cls.virtual_machine = VirtualMachine.create(
                     cls.api_client,
@@ -121,6 +67,8 @@ class TestVmSnapshot(cloudstackTestCase):
                     mode=cls.services["mode"]
                     )
         cls.random_data_0 = random_gen(size=100)
+        cls.test_dir = "/tmp"
+        cls.random_data = "random.data"
         cls._cleanup = [
                 cls.service_offering,
                 cls.account,
@@ -160,8 +108,8 @@ class TestVmSnapshot(cloudstackTestCase):
             ssh_client = self.virtual_machine.get_ssh_client()
 
             cmds = [
-                "echo %s > %s/%s" % (self.random_data_0, self.services["test_dir"], self.services["random_data"]),
-                "cat %s/%s" % (self.services["test_dir"], self.services["random_data"])
+                "echo %s > %s/%s" % (self.random_data_0, self.test_dir, self.random_data),
+                "cat %s/%s" % (self.test_dir, self.random_data)
             ]
 
             for c in cmds:
@@ -184,8 +132,8 @@ class TestVmSnapshot(cloudstackTestCase):
             self.apiclient,
             self.virtual_machine.id,
             "false",
-            self.services["snapshot_name"],
-            self.services["snapshot_displaytext"]
+            "TestSnapshot",
+            "Dsiplay Text"
         )
         self.assertEqual(
             vm_snapshot.state,
@@ -203,8 +151,8 @@ class TestVmSnapshot(cloudstackTestCase):
             ssh_client = self.virtual_machine.get_ssh_client()
 
             cmds = [
-                "rm -rf %s/%s" % (self.services["test_dir"], self.services["random_data"]),
-                "ls %s/%s" % (self.services["test_dir"], self.services["random_data"])
+                "rm -rf %s/%s" % (self.test_dir, self.random_data),
+                "ls %s/%s" % (self.test_dir, self.random_data)
             ]
 
             for c in cmds:
@@ -263,7 +211,7 @@ class TestVmSnapshot(cloudstackTestCase):
             ssh_client = self.virtual_machine.get_ssh_client(reconnect=True)
 
             cmds = [
-                "cat %s/%s" % (self.services["test_dir"], self.services["random_data"])
+                "cat %s/%s" % (self.test_dir, self.random_data)
             ]
 
             for c in cmds:

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/6a2cc9fb/test/integration/smoke/test_volumes.py
----------------------------------------------------------------------
diff --git a/test/integration/smoke/test_volumes.py b/test/integration/smoke/test_volumes.py
index 8f41803..7dee14c 100644
--- a/test/integration/smoke/test_volumes.py
+++ b/test/integration/smoke/test_volumes.py
@@ -34,65 +34,13 @@ import tempfile
 
 _multiprocess_shared_ = True
 
-class Services:
-    """Test Volume Services
-    """
-
-    def __init__(self):
-        self.services = {
-                         "account": {
-                                    "email": "test@test.com",
-                                    "firstname": "Test",
-                                    "lastname": "User",
-                                    "username": "test",
-                                    # Random characters are appended for unique
-                                    # username
-                                    "password": "password",
-                         },
-                         "service_offering": {
-                                    "name": "Tiny Instance",
-                                    "displaytext": "Tiny Instance",
-                                    "cpunumber": 1,
-                                    "cpuspeed": 100,    # in MHz
-                                    "memory": 260       # In MBs
-
-                        },
-                        "disk_offering": {
-                                    "displaytext": "Small",
-                                    "name": "Small",
-                                    "disksize": 1
-                        },
-                        'resized_disk_offering': {
-                                    "displaytext": "Resized",
-                                    "name": "Resized",
-                                    "disksize": 3
-                        },
-                        "volume_offerings": {
-                            0: {
-                                "diskname": "TestDiskServ",
-                            },
-                        },
-                        "customdisksize": 1,    # GBs
-                        "username": "root",     # Creds for SSH to VM
-                        "password": "password",
-                        "ssh_port": 22,
-                        "diskname": "TestDiskServ",
-                        "hypervisor": 'KVM',
-                        "privateport": 22,
-                        "publicport": 22,
-                        "protocol": 'TCP',
-                        "ostype": 'CentOS 5.5 (64-bit)',
-                        "sleep": 10,
-                        "timeout": 600,
-                    }
-
-
 class TestCreateVolume(cloudstackTestCase):
 
     @classmethod
     def setUpClass(cls):
-        cls.api_client = super(TestCreateVolume, cls).getClsTestClient().getApiClient()
-        cls.services = Services().services
+        cloudstackTestClient = super(TestCreateVolume, cls).getClsTestClient()
+        cls.api_client = cloudstackTestClient.getApiClient()
+        cls.services = cloudstackTestClient.getConfigParser().parsedDict
 
         # Get Zone, Domain and templates
         cls.domain = get_domain(cls.api_client, cls.services)
@@ -127,7 +75,7 @@ class TestCreateVolume(cloudstackTestCase):
         cls.services["account"] = cls.account.name
         cls.service_offering = ServiceOffering.create(
                                             cls.api_client,
-                                            cls.services["service_offering"]
+                                            cls.services["service_offerings"]
                                             )
         cls.virtual_machine = VirtualMachine.create(
                                     cls.api_client,
@@ -280,8 +228,10 @@ class TestVolumes(cloudstackTestCase):
 
     @classmethod
     def setUpClass(cls):
-        cls.api_client = super(TestVolumes, cls).getClsTestClient().getApiClient()
-        cls.services = Services().services
+        cloudstackTestClient = super(TestVolumes, cls).getClsTestClient()
+        cls.api_client = cloudstackTestClient.getApiClient()
+        cls.services = cloudstackTestClient.getConfigParser().parsedDict
+
         # Get Zone, Domain and templates
         cls.domain = get_domain(cls.api_client, cls.services)
         cls.zone = get_zone(cls.api_client, cls.services)
@@ -322,7 +272,7 @@ class TestVolumes(cloudstackTestCase):
         cls.services["account"] = cls.account.name
         cls.service_offering = ServiceOffering.create(
                                             cls.api_client,
-                                            cls.services["service_offering"]
+                                            cls.services["service_offerings"]
                                         )
         cls.virtual_machine = VirtualMachine.create(
                                     cls.api_client,

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/6a2cc9fb/test/integration/smoke/test_vpc_vpn.py
----------------------------------------------------------------------
diff --git a/test/integration/smoke/test_vpc_vpn.py b/test/integration/smoke/test_vpc_vpn.py
index 5e97c79..d8e66d6 100644
--- a/test/integration/smoke/test_vpc_vpn.py
+++ b/test/integration/smoke/test_vpc_vpn.py
@@ -26,96 +26,19 @@ from nose.plugins.attrib import attr
 
 import time
 
-class Services:
-    def __init__(self):
-        self.services = {
-            "account": {
-                "email": "test@test.com",
-                "firstname": "Test",
-                "lastname": "User",
-                "username": "test",
-                "password": "password",
-            },
-            "virtual_machine": {
-                "displayname": "Test VM",
-                "username": "root",
-                "password": "password",
-                "ssh_port": 22,
-                "hypervisor": 'XenServer',
-                "privateport": 22,
-                "publicport": 22,
-                "protocol": 'TCP',
-            },
-            "ostype": 'CentOS 5.3 (64-bit)',
-            "service_offering": {
-                "name": "Tiny Instance",
-                "displaytext": "Tiny Instance",
-                "cpunumber": 1,
-                "cpuspeed": 100,
-                "memory": 256,
-            },
-            "network_offering": {
-                "name": "Network offering for internal vpc",
-                "displaytext": "Network offering for internal vpc",
-                "guestiptype": "Isolated",
-                "traffictype": "Guest",
-                "supportedservices": "Vpn,Dhcp,Dns,Lb,UserData,SourceNat,StaticNat,PortForwarding,NetworkACL",
-                "serviceProviderList": {
-                    "Dhcp": "VpcVirtualRouter",
-                    "Dns": "VpcVirtualRouter",
-                    "Vpn": "VpcVirtualRouter",
-                    "UserData": "VpcVirtualRouter",
-                    "Lb": "InternalLbVM",
-                    "SourceNat": "VpcVirtualRouter",
-                    "StaticNat": "VpcVirtualRouter",
-                    "PortForwarding": "VpcVirtualRouter",
-                    "NetworkACL": "VpcVirtualRouter",
-                },
-                "serviceCapabilityList": {
-                    "SourceNat": {"SupportedSourceNatTypes": "peraccount"},
-                    "Lb": {"lbSchemes": "internal", "SupportedLbIsolation": "dedicated"}
-                }
-            },
-            "vpn_user": {
-                "username": "test",
-                "password": "password",
-            },
-            "vpc": {
-                "name": "vpc_vpn",
-                "displaytext": "vpc-vpn",
-                "cidr": "10.1.1.0/24"
-            },
-            "ntwk": {
-                "name": "tier1",
-                "displaytext": "vpc-tier1",
-                "gateway" : "10.1.1.1",
-                "netmask" : "255.255.255.192"
-            },
-            "vpc2": {
-                "name": "vpc2_vpn",
-                "displaytext": "vpc2-vpn",
-                "cidr": "10.2.1.0/24"
-            },
-            "ntwk2": {
-                "name": "tier2",
-                "displaytext": "vpc-tier2",
-                "gateway" : "10.2.1.1",
-                "netmask" : "255.255.255.192"
-            }
-        }
-
-
 class TestVpcRemoteAccessVpn(cloudstackTestCase):
 
     @classmethod
     def setUpClass(cls):
-        cls.apiclient = super(TestVpcRemoteAccessVpn, cls).getClsTestClient().getApiClient()
-        cls.services = Services().services
+        cloudstackTestClient = super(TestVpcRemoteAccessVpn, cls).getClsTestClient()
+        cls.api_client = cloudstackTestClient.getApiClient()
+        cls.services = cloudstackTestClient.getConfigParser().parsedDict
+
         cls.zone = get_zone(cls.apiclient, cls.services)
         cls.domain = get_domain(cls.apiclient)
         cls.service_offering = ServiceOffering.create(
             cls.apiclient,
-            cls.services["service_offering"]
+            cls.services["service_offerings"]
         )
         cls.account = Account.create(cls.apiclient, services=cls.services["account"])
         cls.template = get_template(
@@ -211,13 +134,15 @@ class TestVpcSite2SiteVpn(cloudstackTestCase):
 
     @classmethod
     def setUpClass(cls):
-        cls.apiclient = super(TestVpcSite2SiteVpn, cls).getClsTestClient().getApiClient()
-        cls.services = Services().services
+        cloudstackTestClient = super(TestVpcSite2SiteVpn, cls).getClsTestClient()
+        cls.api_client = cloudstackTestClient.getApiClient()
+        cls.services = cloudstackTestClient.getConfigParser().parsedDict
+
         cls.zone = get_zone(cls.apiclient, cls.services)
         cls.domain = get_domain(cls.apiclient)
         cls.service_offering = ServiceOffering.create(
             cls.apiclient,
-            cls.services["service_offering"]
+            cls.services["service_offerings"]
         )
         cls.account = Account.create(cls.apiclient, services=cls.services["account"])
         cls.template = get_template(

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/6a2cc9fb/tools/marvin/marvin/config/config.cfg
----------------------------------------------------------------------
diff --git a/tools/marvin/marvin/config/config.cfg b/tools/marvin/marvin/config/config.cfg
index 7840b7c..eb51005 100644
--- a/tools/marvin/marvin/config/config.cfg
+++ b/tools/marvin/marvin/config/config.cfg
@@ -24,7 +24,7 @@
                     }
                   ,
         "project":
-        {
+                  {
                     "name": "Project",
                     "displaytext": "Test project"
                    },
@@ -35,6 +35,15 @@
                     "username": "test-account",
                     "password": "password"
                     },
+        "user": {
+                    "email": "user@test.com",
+                    "firstname": "User",
+                    "lastname": "User",
+                    "username": "User",
+                    # Random characters are appended for unique
+                    # username
+                    "password": "fr3sca",
+                },
         "service_offering": {
                              "name": "Tiny Instance",
                              "displaytext": "Tiny Instance",
@@ -74,6 +83,18 @@
                             "publicport": 22,
                             "protocol": "TCP"
                             },
+        "template": {
+                        "displaytext": "Public Template",
+                        "name": "Public template",
+                        "ostype": 'CentOS 5.3 (64-bit)',
+                        "url": "",
+                        "hypervisor": '',
+                        "format": '',
+                        "isfeatured": True,
+                        "ispublic": True,
+                        "isextractable": True,
+                        "templatefilter": "self"
+                    },
         "shared_network": {
                            "name": "Test Shared Network",
                            "displaytext": "Test Shared Network",
@@ -137,6 +158,11 @@
                                         }
                                 },
         "security_group" : { "name": "custom_Sec_Grp" },
+         "natrule": {
+                        "publicport": 22,
+                        "privateport": 22,
+                        "protocol": 'TCP',
+                    },
         "ingress_rule": {
                          "protocol": "TCP",
                          "startport": "22",

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/6a2cc9fb/tools/marvin/marvin/config/test_data.cfg
----------------------------------------------------------------------
diff --git a/tools/marvin/marvin/config/test_data.cfg b/tools/marvin/marvin/config/test_data.cfg
index ef0a6b3..e98d26f 100644
--- a/tools/marvin/marvin/config/test_data.cfg
+++ b/tools/marvin/marvin/config/test_data.cfg
@@ -18,143 +18,437 @@
 # Use the common configs added such as account, network_offerings, domain, project,
 # or add your own data if required separately for any test case
 {
+        "region": {
+                "regionid": "2",
+                "regionname": "Region2",
+                "regionendpoint": "http://region2:8080/client"
+        },
         "zone": "NA",
-        "domain":
-                    {
-                        "name": "domain"
-                    }
-                  ,
-        "project":
-        {
-                    "name": "Project",
-                    "displaytext": "Test project"
-                   },
+        
+        "domain": { "name": "domain" },
+        
+        "project": {
+            "name": "Project",
+            "displaytext": "Test project"
+        },
         "account": {
-                    "email": "test-account@test.com",
-                    "firstname": "test",
-                    "lastname": "test",
-                    "username": "test-account",
-                    "password": "password"
-                    },
-        "service_offering": {
-                             "name": "Tiny Instance",
-                             "displaytext": "Tiny Instance",
-                             "cpunumber": 1,
-                             "cpuspeed": 100,
-                             "memory": 128
-                            },
+            "email": "test-account@test.com",
+            "firstname": "test",
+            "lastname": "test",
+            "username": "test-account",
+            "password": "password"
+        }, 
+        "small": {
+            # Create a small virtual machine instance with disk offering
+            "displayname": "testserver",
+            "username": "root", # VM creds for SSH
+            "password": "password",
+            "ssh_port": 22,
+            "hypervisor": 'XenServer',
+            "privateport": 22,
+            "publicport": 22,
+            "protocol": 'TCP',
+        },
+        "medium": {
+            # Create a medium virtual machine instance
+            "displayname": "testserver",
+            "username": "root",
+            "password": "password",
+            "ssh_port": 22,
+            "hypervisor": 'XenServer',
+            "privateport": 22,
+            "publicport": 22,
+            "protocol": 'TCP',
+        },
+        "service_offerings": {
+            "name": "Tiny Instance",
+            "displaytext": "Tiny Instance",
+            "cpunumber": 1,
+            "cpuspeed": 100,
+            "memory": 128,
+            
+            "tiny": {
+                "name": "Tiny Instance",
+                "displaytext": "Tiny Instance",
+                "cpunumber": 1,
+                "cpuspeed": 100, # in MHz
+                "memory": 128, # In MBs
+            },   
+            "small": {
+                "name": "Small Instance",
+                "displaytext": "Small Instance",
+                "cpunumber": 1,
+                "cpuspeed": 100,
+                "memory": 256 
+            },
+            "medium": {
+                "name": "Medium Instance",
+                "displaytext": "Medium Instance",
+                "cpunumber": 1,
+                "cpuspeed": 100,
+                "memory": 256,
+            },
+            "big": {
+                "name": "BigInstance",
+                "displaytext": "BigInstance",
+                "cpunumber": 1,
+                "cpuspeed": 100,
+                "memory": 512,
+            }
+        },
+        "disk_offering": {
+            "name": "Disk offering",
+            "displaytext": "Disk offering",
+            "disksize": 1   # in GB
+        },
+        'resized_disk_offering': {
+            "displaytext": "Resized",
+            "name": "Resized",
+            "disksize": 3
+        },
+        "network": {
+            "name": "Test Network",
+            "displaytext": "Test Network",
+            acltype": "Account",
+        },
+        "network2": {
+            "name": "Test Network Shared",
+            "displaytext": "Test Network Shared",
+            "vlan" :1201,
+            "gateway" :"172.16.15.1",
+            "netmask" :"255.255.255.0",
+            "startip" :"172.16.15.21",
+            "endip" :"172.16.15.41",
+            "acltype": "Account",
+        },
+        "network_offering": {
+            "name": 'Test Network offering',
+            "displaytext": 'Test Network offering',
+            "guestiptype": 'Isolated',
+            "supportedservices": 'Dhcp,Dns,SourceNat,PortForwarding',
+            "traffictype": 'GUEST',
+            "availability": 'Optional',
+            "serviceProviderList" : {
+                "Dhcp": 'VirtualRouter',
+                "Dns": 'VirtualRouter',
+                "SourceNat": 'VirtualRouter',
+                "PortForwarding": 'VirtualRouter',
+            },
+        },
         "isolated_network_offering": {
-                                      "name": "Network offering-DA services",
-                                      "displaytext": "Network offering-DA services",
-                                      "guestiptype": "Isolated",
-                                      "supportedservices": "Dhcp,Dns,SourceNat,PortForwarding,Vpn,Firewall,Lb,UserData,StaticNat",
-                                      "traffictype": "GUEST",
-                                      "availability": "Optional'",
-                                      "serviceProviderList": {
-                                            "Dhcp": "VirtualRouter",
-                                            "Dns": "VirtualRouter",
-                                            "SourceNat": "VirtualRouter",
-                                            "PortForwarding": "VirtualRouter",
-                                            "Vpn": "VirtualRouter",
-                                            "Firewall": "VirtualRouter",
-                                            "Lb": "VirtualRouter",
-                                            "UserData": "VirtualRouter",
-                                            "StaticNat": "VirtualRouter"
-                                        }
-                                    },
+            "name": "Network offering-DA services",
+            "displaytext": "Network offering-DA services",
+            "guestiptype": "Isolated",
+            "supportedservices": "Dhcp,Dns,SourceNat,PortForwarding,Vpn,Firewall,Lb,UserData,StaticNat",
+            "traffictype": "GUEST",
+            "availability": "Optional'",
+            "serviceProviderList": {
+                "Dhcp": "VirtualRouter",
+                "Dns": "VirtualRouter",
+                "SourceNat": "VirtualRouter",
+                "PortForwarding": "VirtualRouter",
+                "Vpn": "VirtualRouter",
+                "Firewall": "VirtualRouter",
+                "Lb": "VirtualRouter",
+                "UserData": "VirtualRouter",
+                "StaticNat": "VirtualRouter"
+            }
+        },
         "isolated_network": {
-                             "name": "Isolated Network",
-                             "displaytext": "Isolated Network"
-                            },
+            "name": "Isolated Network",
+            "displaytext": "Isolated Network"
+        },
         "virtual_machine": {
-                            "displayname": "Test VM",
-                            "username": "root",
-                            "password": "password",
-                            "ssh_port": 22,
-                            "privateport": 22,
-                            "publicport": 22,
-                            "protocol": "TCP"
-                            },
+            "displayname": "Test VM",
+            "username": "root",
+            "password": "password",
+            "ssh_port": 22,
+            "privateport": 22,
+            "publicport": 22,
+            "protocol": "TCP",
+            "affinity": {
+                "name": "webvms",
+                "type": "host anti-affinity",
+            },
+        },
+        "server_without_disk": {
+            "displayname": "Test VM-No Disk",
+            "username": "root",
+            "password": "password",
+            "ssh_port": 22,
+            "hypervisor": 'XenServer',
+            "privateport": 22,
+            # For NAT rule creation
+            "publicport": 22,
+            "protocol": 'TCP',
+        },
         "shared_network": {
-                           "name": "MySharedNetwork - Test",
-                           "displaytext": "MySharedNetwork",
-                           "vlan" : "",
-                           "gateway" :"",
-                           "netmask" :"",
-                           "startip" :"",
-                           "endip" :"",
-                           "acltype" : "Domain",
-                           "scope":"all"
-                          },
+            "name": "MySharedNetwork - Test",
+            "displaytext": "MySharedNetwork",
+            "vlan" : "",
+            "gateway" :"",
+            "netmask" :"",
+            "startip" :"",
+            "endip" :"",
+            "acltype" : "Domain",
+            "scope":"all"
+        },
         "shared_network_offering_sg": {
-                                    "name": "MySharedOffering-sg",
-                                    "displaytext": "MySharedOffering-sg",
-                                    "guestiptype": "Shared",
-                                    "supportedservices": "Dhcp,Dns,UserData,SecurityGroup",
-                                    "specifyVlan" : "False",
-                                    "specifyIpRanges" : "False",
-                                    "traffictype": "GUEST",
-                                    "serviceProviderList" : {
-                                            "Dhcp": "VirtualRouter",
-                                            "Dns": "VirtualRouter",
-                                            "UserData": "VirtualRouter",
-                                            "SecurityGroup": "SecurityGroupProvider"
-                                        }
-                                },
+            "name": "MySharedOffering-sg",
+            "displaytext": "MySharedOffering-sg",
+            "guestiptype": "Shared",
+            "supportedservices": "Dhcp,Dns,UserData,SecurityGroup",
+            "specifyVlan" : "False",
+            "specifyIpRanges" : "False",
+            "traffictype": "GUEST",
+            "serviceProviderList" : {
+                "Dhcp": "VirtualRouter",
+                "Dns": "VirtualRouter",
+                "UserData": "VirtualRouter",
+                "SecurityGroup": "SecurityGroupProvider"
+            }
+        },
         "shared_network_sg": {
-                                  "name": "Shared-Network-SG-Test",
-                                  "displaytext": "Shared-Network_SG-Test",
-                                  "networkofferingid":"1",
-                                  "vlan" : "",
-                                  "gateway" :"",
-                                  "netmask" :"255.255.255.0",
-                                  "startip" :"",
-                                  "endip" :"",
-                                  "acltype" : "Domain",
-                                  "scope":"all"
-                                },
+            "name": "Shared-Network-SG-Test",
+            "displaytext": "Shared-Network_SG-Test",
+            "networkofferingid":"1",
+            "vlan" : "",
+            "gateway" :"",
+            "netmask" :"255.255.255.0",
+            "startip" :"",
+            "endip" :"",
+            "acltype" : "Domain",
+            "scope":"all"
+        },
         "vpc_offering": {
-                         "name": "VPC off",
-                         "displaytext": "VPC off",
-                         "supportedservices": "Dhcp,Dns,SourceNat,PortForwarding,Vpn,Lb,UserData,StaticNat,NetworkACL"
-                        },
+            "name": "VPC off",
+            "displaytext": "VPC off",
+            "supportedservices": "Dhcp,Dns,SourceNat,PortForwarding,Vpn,Lb,UserData,StaticNat,NetworkACL"
+        },
         "vpc": {
-                "name": "TestVPC",
-                "displaytext": "TestVPC",
-                "cidr": "10.0.0.1/24"
-                },
-        "shared_network_offering": {
-                                    "name": "MySharedOffering",
-                                    "displaytext": "MySharedOffering",
-                                    "guestiptype": "Shared",
-                                    "supportedservices": "Dhcp,Dns,UserData",
-                                    "specifyVlan" : "False",
-                                    "specifyIpRanges" : "False",
-                                    "traffictype": "GUEST",
-                                    "serviceProviderList" : {
-                                            "Dhcp": "VirtualRouter",
-                                            "Dns": "VirtualRouter",
-                                            "UserData": "VirtualRouter"
-                                        }
-                                },
+            "name": "TestVPC",
+            "displaytext": "TestVPC",
+            "cidr": "10.0.0.1/24"
+        },
+        "clusters": {
+            0: {
+                "clustername": "Xen Cluster",
+                "clustertype": "CloudManaged",
+                # CloudManaged or ExternalManaged"
+                "hypervisor": "XenServer",
+                # Hypervisor type
+            },
+            1: {
+                "clustername": "KVM Cluster",
+                "clustertype": "CloudManaged",
+                # CloudManaged or ExternalManaged"
+                "hypervisor": "KVM",
+                # Hypervisor type
+            },
+            2: {
+                "hypervisor": 'VMware',
+                # Hypervisor type
+                "clustertype": 'ExternalManaged',
+                # CloudManaged or ExternalManaged"
+                "username": 'administrator',
+                "password": 'fr3sca',
+                "url": 'http://192.168.100.17/CloudStack-Clogeny-Pune/Pune-1',
+                # Format:http://vCenter Host/Datacenter/Cluster
+                "clustername": 'VMWare Cluster',
+            },
+        },
+        "hosts": {
+            "xenserver": {
+                # Must be name of corresponding Hypervisor type
+                # in cluster in small letters
+                "hypervisor": 'XenServer',
+                # Hypervisor type
+                "clustertype": 'CloudManaged',
+                # CloudManaged or ExternalManaged"
+                "url": 'http://192.168.100.211',
+                "username": "root",
+                "password": "fr3sca",
+            },
+            "kvm": {
+                "hypervisor": 'KVM',
+                # Hypervisor type
+                "clustertype": 'CloudManaged',
+                # CloudManaged or ExternalManaged"
+                "url": 'http://192.168.100.212',
+                "username": "root",
+                "password": "fr3sca",
+            },
+            "vmware": {
+                "hypervisor": 'VMware',
+                # Hypervisor type
+                "clustertype": 'ExternalManaged',
+                # CloudManaged or ExternalManaged"
+                "url": 'http://192.168.100.203',
+                "username": "administrator",
+                "password": "fr3sca",
+            },
+        },
+        "network_offering_shared": {
+            "name": 'Test Network offering shared',
+            "displaytext": 'Test Network offering Shared',
+            "guestiptype": 'Shared',
+            "supportedservices": 'Dhcp,Dns,UserData',
+            "traffictype": 'GUEST',
+            "specifyVlan" : "True",
+            "specifyIpRanges" : "True",
+            "serviceProviderList" : {
+                "Dhcp": 'VirtualRouter',
+                "Dns": 'VirtualRouter',
+                "UserData": 'VirtualRouter',
+            },
+        },        
+        "network_offering_internal_lb": {
+            "name": "Network offering for internal lb service",
+            "displaytext": "Network offering for internal lb service",
+            "guestiptype": "Isolated",
+            "traffictype": "Guest",
+            "supportedservices": "Vpn,Dhcp,Dns,Lb,UserData,SourceNat,StaticNat,PortForwarding,NetworkACL",
+            "serviceProviderList": {
+                "Dhcp": "VpcVirtualRouter",
+                "Dns": "VpcVirtualRouter",
+                "Vpn": "VpcVirtualRouter",
+                "UserData": "VpcVirtualRouter",
+                "Lb": "InternalLbVM",
+                "SourceNat": "VpcVirtualRouter",
+                "StaticNat": "VpcVirtualRouter",
+                "PortForwarding": "VpcVirtualRouter",
+                "NetworkACL": "VpcVirtualRouter",
+            },
+            "serviceCapabilityList": {
+                "SourceNat": {"SupportedSourceNatTypes": "peraccount"},
+                "Lb": {"lbSchemes": "internal", "SupportedLbIsolation": "dedicated"}
+            }
+        },
+
+        "natrule": {
+            "privateport": 22,
+            "publicport": 2222,
+            "protocol": "TCP"
+        },
+        "lbrule": {
+            "name": "SSH",
+            "alg": "roundrobin",
+            # Algorithm used for load balancing
+            "privateport": 22,
+            "publicport": 2222,
+            "protocol": 'TCP'
+        },
+
+        # ISO related test data
+        "iso1": {
+            "displaytext": "Test ISO 1",
+            "name": "ISO 1",
+            "url": "http://people.apache.org/~tsp/dummy.iso",
+            # Source URL where ISO is located
+            "isextractable": True,
+            "isfeatured": True,
+            "ispublic": True,
+            "ostype": "CentOS 5.3 (64-bit)",
+        },
+        "iso2": {
+            "displaytext": "Test ISO 2",
+            "name": "ISO 2",
+            "url": "http://people.apache.org/~tsp/dummy.iso",
+            # Source URL where ISO is located
+            "isextractable": True,
+            "isfeatured": True,
+            "ispublic": True,
+            "ostype": "CentOS 5.3 (64-bit)",
+            "mode": 'HTTP_DOWNLOAD',
+            # Used in Extract template, value must be HTTP_DOWNLOAD
+        },
+        "isfeatured": True,
+        "ispublic": True,
+        "isextractable": True,
+        "bootable": True, # For edit template
+        "passwordenabled": True,
+        
+        "template": {
+            "displaytext": "xs",
+            "name": "xs",
+            "passwordenabled": False,
+        },
+        "template_2": {
+            "displaytext": "Public Template",
+            "name": "Public template",
+            "ostype": "CentOS 5.3 (64-bit)",
+            "isfeatured": True,
+            "ispublic": True,
+            "isextractable": True,
+            "mode": "HTTP_DOWNLOAD",
+        },
+        "templatefilter": 'self',
+
         "security_group" : { "name": "custom_Sec_Grp" },
         "ingress_rule": {
-                         "protocol": "TCP",
-                         "startport": "22",
-                         "endport": "22",
-                         "cidrlist": "0.0.0.0/0"
-                        },
+            "protocol": "TCP",
+            startport": "22",
+            "endport": "22",
+            "cidrlist": "0.0.0.0/0"
+        },
         "ostype": "CentOS 5.3 (64-bit)",
         "sleep": 90,
         "timeout": 10,
         "advanced_sg": {
-                         "zone": {
-                                    "name": "",
-                                    "dns1": "8.8.8.8",
-                                    "internaldns1": "192.168.100.1",
-                                    "networktype": "Advanced",
-                                    "securitygroupenabled": "true"
-                                },
-                         "securitygroupenabled": "true"
-                       }
+            "zone": {
+                "name": "",
+                "dns1": "8.8.8.8",
+                "internaldns1": "192.168.100.1",
+                "networktype": "Advanced",
+                "securitygroupenabled": "true"
+            },
+            "securitygroupenabled": "true"
+        },
+        "vlan": {
+            "part": ["4090-4091", "4092-4095"],
+            "full": "4090-4095",
+        },
+        nfs": {
+            "url": "nfs://10.147.28.7/export/home/talluri/testprimary",
+            # Format: File_System_Type/Location/Path
+            "name": "Primary XEN"
+        },
+        "iscsi": {
+            "url": "iscsi://192.168.100.21/iqn.2012-01.localdomain.clo-cstack-cos6:iser/1",
+            # Format : iscsi://IP Address/IQN number/LUN#
+            "name": "Primary iSCSI"
+        },
+        "volume": {"diskname": "Test Volume"},
+        "volume_offerings": {
+            0: {"diskname": "TestDiskServ"},
+        },
+        "diskdevice": ['/dev/vdc',  '/dev/vdb', '/dev/hdb', '/dev/hdc', '/dev/xvdd', '/dev/cdrom', '/dev/sr0',  '/dev/cdrom1' ],
+        
+        #test_vpc_vpn.py
+        "vpn_user": {
+            "username": "test",
+            "password": "password",
+        },
+        "vpc": {
+            "name": "vpc_vpn",
+            "displaytext": "vpc-vpn",
+            "cidr": "10.1.1.0/24"
+        },
+        "ntwk": {
+            "name": "tier1",
+            "displaytext": "vpc-tier1",
+            "gateway" : "10.1.1.1",
+            "netmask" : "255.255.255.192"
+        },
+        "vpc2": {
+            "name": "vpc2_vpn",
+            "displaytext": "vpc2-vpn",
+            "cidr": "10.2.1.0/24"
+        },
+        "ntwk2": {
+            "name": "tier2",
+            "displaytext": "vpc-tier2",
+            "gateway" : "10.2.1.1",
+            "netmask" : "255.255.255.192"
+        }
 }


[2/4] git commit: updated refs/heads/marvin to 6a2cc9f

Posted by gi...@apache.org.
CLOUDSTACK-5674: Added Fix for CLOUDSTACK-5674,5498,5500 and other issues as
 part of cleanup


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

Branch: refs/heads/marvin
Commit: 939327561192eba7f21f6d5acb0119278984b510
Parents: 99b9198
Author: Santhosh Edukulla <Sa...@citrix.com>
Authored: Mon Jan 20 13:19:39 2014 +0530
Committer: Girish Shilamkar <gi...@clogeny.com>
Committed: Wed Jan 22 12:19:20 2014 +0530

----------------------------------------------------------------------
 setup/dev/advanced.cfg                          |  15 +-
 setup/dev/basic.cfg                             |  11 +-
 .../component/test_add_remove_network.py        |   6 +-
 .../component/test_affinity_groups.py           |  24 +-
 .../component/test_cpu_domain_limits.py         |  12 +-
 test/integration/component/test_cpu_limits.py   |   8 +-
 .../component/test_cpu_max_limits.py            |   8 +-
 .../component/test_cpu_project_limits.py        |   2 +-
 .../integration/component/test_memory_limits.py |   8 +-
 .../component/test_mm_domain_limits.py          |  12 +-
 .../integration/component/test_mm_max_limits.py |   8 +-
 .../component/test_mm_project_limits.py         |   2 +-
 test/integration/component/test_portable_ip.py  |   8 +-
 test/integration/component/test_vpc.py          |   2 +-
 test/integration/component/test_vpn_users.py    |   4 +-
 test/integration/smoke/test_affinity_groups.py  |   4 +-
 test/integration/smoke/test_deploy_vm.py        |   2 +-
 .../smoke/test_deploy_vm_with_userdata.py       |   2 +-
 tools/marvin/marvin/asyncJobMgr.py              |   4 +-
 tools/marvin/marvin/cloudstackConnection.py     | 426 +++++++++-------
 tools/marvin/marvin/cloudstackException.py      |  15 +-
 tools/marvin/marvin/cloudstackTestClient.py     | 495 +++++++++++++------
 tools/marvin/marvin/codegenerator.py            |   4 +-
 tools/marvin/marvin/codes.py                    |  15 +
 tools/marvin/marvin/config/__init__.py          |   0
 tools/marvin/marvin/config/test_data.cfg        | 160 ++++++
 tools/marvin/marvin/configGenerator.py          |  84 ++--
 tools/marvin/marvin/dbConnection.py             |   4 +-
 tools/marvin/marvin/deployDataCenter.py         | 321 ++++++++----
 tools/marvin/marvin/integration/lib/common.py   | 243 +++++----
 tools/marvin/marvin/jsonHelper.py               |   4 +-
 tools/marvin/marvin/lib/__init__.py             |   0
 tools/marvin/marvin/marvinInit.py               | 172 ++++---
 tools/marvin/marvin/marvinLog.py                | 122 ++++-
 tools/marvin/marvin/marvinPlugin.py             | 139 ++++--
 tools/marvin/marvin/src/__init__.py             |   0
 tools/marvin/marvin/tcExecuteEngine.py          |   7 +-
 37 files changed, 1603 insertions(+), 750 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/93932756/setup/dev/advanced.cfg
----------------------------------------------------------------------
diff --git a/setup/dev/advanced.cfg b/setup/dev/advanced.cfg
index 23981f0..7982217 100644
--- a/setup/dev/advanced.cfg
+++ b/setup/dev/advanced.cfg
@@ -17,7 +17,7 @@
 {
     "zones": [
         {
-            "name": "Sandbox-simulator",
+            "name": "Sandbox-simulator-new",
             "guestcidraddress": "10.1.1.0/24",
             "dns1": "10.147.28.6",
             "physical_networks": [
@@ -137,7 +137,7 @@
         "port": 3306,
         "user": "cloud"
     },
-    "logger": 
+    "logger":
         {
             "LogFolderPath": "/tmp/"
         },
@@ -218,5 +218,14 @@
             "certCAPath":  "NA",
             "certPath":  "NA"
         }
-    ]
+    ],
+    "ApiLoadCfg":
+    {
+        "ParsedApiDestFolder": ".",
+        "ApiSpecFile": "/etc/cloud/cli/commands.xml"
+    },
+    "TestData":
+    {
+      "Path": "config/config.cfg"
+    }
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/93932756/setup/dev/basic.cfg
----------------------------------------------------------------------
diff --git a/setup/dev/basic.cfg b/setup/dev/basic.cfg
index 3e39d6d..196a191 100644
--- a/setup/dev/basic.cfg
+++ b/setup/dev/basic.cfg
@@ -172,5 +172,14 @@
             "user": "root",
             "port": 8096
         }
-    ]
+    ],
+    "ApiLoadCfg":
+    {
+        "ParsedApiDestFolder": ".",
+        "ApiSpecFile": "/etc/cloud/cli/commands.xml"
+    },
+    "TestData":
+    {
+      "Path": "config/config.cfg"
+    }
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/93932756/test/integration/component/test_add_remove_network.py
----------------------------------------------------------------------
diff --git a/test/integration/component/test_add_remove_network.py b/test/integration/component/test_add_remove_network.py
index 4529ec7..6eef71e 100644
--- a/test/integration/component/test_add_remove_network.py
+++ b/test/integration/component/test_add_remove_network.py
@@ -1300,7 +1300,7 @@ class TestFailureScenariosAddNetworkToVM(cloudstackTestCase):
         self.debug("Created account %s" % account.name)
 
         self.debug("creating user api client for account: %s" % account.name)
-        api_client = self.testClient.createUserApiClient(UserName=account.name, DomainName=self.account.domain)
+        api_client = self.testClient.getUserApiClient(UserName=account.name, DomainName=self.account.domain)
 
         self.debug("Trying to add network to vm with this api client, this should fail due to \
                     insufficient permission")
@@ -1478,7 +1478,7 @@ class TestFailureScenariosRemoveNicFromVM(cloudstackTestCase):
         self.debug("Created account %s" % account.name)
 
         self.debug("creating user api client for account: %s" % account.name)
-        api_client = self.testClient.createUserApiClient(UserName=account.name, DomainName=self.account.domain)
+        api_client = self.testClient.getUserApiClient(UserName=account.name, DomainName=self.account.domain)
 
         self.debug("Trying to add network to vm with this api client, this should fail due to \
                     insufficient permission")
@@ -1749,7 +1749,7 @@ class TestFailureScenariosUpdateVirtualMachineNIC(cloudstackTestCase):
         self.debug("Created account %s" % account.name)
 
         self.debug("creating user api client for account: %s" % account.name)
-        api_client = self.testClient.createUserApiClient(UserName=account.name, DomainName=self.account.domain)
+        api_client = self.testClient.getUserApiClient(UserName=account.name, DomainName=self.account.domain)
 
         self.debug("Listing virtual machine so that to retrive the list of non-default and default nic")
         vm_list = list_virtual_machines(self.apiclient, id=self.virtual_machine.id)

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/93932756/test/integration/component/test_affinity_groups.py
----------------------------------------------------------------------
diff --git a/test/integration/component/test_affinity_groups.py b/test/integration/component/test_affinity_groups.py
index 7e4fabe..4fdb8f6 100644
--- a/test/integration/component/test_affinity_groups.py
+++ b/test/integration/component/test_affinity_groups.py
@@ -197,7 +197,7 @@ class TestCreateAffinityGroup(cloudstackTestCase):
         self.cleanup.append(self.do_admin)
         self.cleanup.append(self.new_domain)
 
-        domainapiclient = self.testClient.createUserApiClient(self.do_admin.name, self.new_domain.name, 2)
+        domainapiclient = self.testClient.getUserApiClient(self.do_admin.name, self.new_domain.name, 2)
 
         aff_grp = self.create_aff_grp(api_client=domainapiclient, aff_grp=self.services["host_anti_affinity"],
                                             acc=self.do_admin.name, domainid=self.new_domain.id)
@@ -214,7 +214,7 @@ class TestCreateAffinityGroup(cloudstackTestCase):
         self.user = Account.create(self.api_client, self.services["new_account"],
                                   domainid=self.domain.id)
 
-        userapiclient = self.testClient.createUserApiClient(self.user.name, self.domain.name)
+        userapiclient = self.testClient.getUserApiClient(self.user.name, self.domain.name)
 
         self.cleanup.append(self.user)
         aff_grp = self.create_aff_grp(api_client=userapiclient, aff_grp=self.services["host_anti_affinity"],
@@ -704,7 +704,7 @@ class TestDeleteAffinityGroups(cloudstackTestCase):
         self.user2 = Account.create(self.apiclient, self.services["new_account1"])
         self.cleanup.append(self.user2)
 
-        userapiclient = self.testClient.createUserApiClient(
+        userapiclient = self.testClient.getUserApiClient(
                                         UserName=self.user2.name,
                                         DomainName=self.user2.domain,
                                         acctType=0)
@@ -740,7 +740,7 @@ class TestDeleteAffinityGroups(cloudstackTestCase):
         self.user2 = Account.create(self.apiclient, self.services["new_account1"])
         self.cleanup.append(self.user2)
 
-        userapiclient = self.testClient.createUserApiClient(
+        userapiclient = self.testClient.getUserApiClient(
                                         UserName=self.user2.name,
                                         DomainName=self.user2.domain,
                                         acctType=0)
@@ -781,7 +781,7 @@ class TestDeleteAffinityGroups(cloudstackTestCase):
                                        self.services["new_account"])
 
         self.cleanup.append(self.user1)
-        user1apiclient = self.testClient.createUserApiClient(
+        user1apiclient = self.testClient.getUserApiClient(
                                         UserName=self.user1.name,
                                         DomainName=self.user1.domain,
                                         acctType=0)
@@ -1294,7 +1294,7 @@ class TestDeployVMAffinityGroups(cloudstackTestCase):
         self.user2 = Account.create(self.apiclient, self.services["new_account1"])
         self.cleanup.append(self.user2)
 
-        userapiclient = self.testClient.createUserApiClient(
+        userapiclient = self.testClient.getUserApiClient(
                                         UserName=self.user2.name,
                                         DomainName=self.user2.domain,
                                         acctType=0)
@@ -1327,7 +1327,7 @@ class TestDeployVMAffinityGroups(cloudstackTestCase):
         self.user2 = Account.create(self.apiclient, self.services["new_account1"])
         self.cleanup.append(self.user2)
 
-        userapiclient = self.testClient.createUserApiClient(
+        userapiclient = self.testClient.getUserApiClient(
                                         UserName=self.user2.name,
                                         DomainName=self.user2.domain,
                                         acctType=0)
@@ -1549,7 +1549,7 @@ class TestAffinityGroupsAdminUser(cloudstackTestCase):
                                        self.services["new_account"])
 
         self.cleanup.append(self.user1)
-        userapiclient = self.testClient.createUserApiClient(
+        userapiclient = self.testClient.getUserApiClient(
                                         UserName=self.user1.name,
                                         DomainName=self.user1.domain,
                                         acctType=0)
@@ -1588,7 +1588,7 @@ class TestAffinityGroupsAdminUser(cloudstackTestCase):
                                        self.services["new_account"])
 
         self.cleanup.append(self.user1)
-        userapiclient = self.testClient.createUserApiClient(
+        userapiclient = self.testClient.getUserApiClient(
                                         UserName=self.user1.name,
                                         DomainName=self.user1.domain,
                                         acctType=0)
@@ -1638,7 +1638,7 @@ class TestAffinityGroupsAdminUser(cloudstackTestCase):
                                        self.services["new_account"])
 
         self.cleanup.append(self.user1)
-        userapiclient = self.testClient.createUserApiClient(
+        userapiclient = self.testClient.getUserApiClient(
                                         UserName=self.user1.name,
                                         DomainName=self.user1.domain,
                                         acctType=0)
@@ -1674,7 +1674,7 @@ class TestAffinityGroupsAdminUser(cloudstackTestCase):
                                        self.services["new_account"])
 
         self.cleanup.append(self.user1)
-        userapiclient = self.testClient.createUserApiClient(
+        userapiclient = self.testClient.getUserApiClient(
                                         UserName=self.user1.name,
                                         DomainName=self.user1.domain,
                                         acctType=0)
@@ -1706,7 +1706,7 @@ class TestAffinityGroupsAdminUser(cloudstackTestCase):
                                        self.services["new_account"])
 
         self.cleanup.append(self.user1)
-        userapiclient = self.testClient.createUserApiClient(
+        userapiclient = self.testClient.getUserApiClient(
                                         UserName=self.user1.name,
                                         DomainName=self.user1.domain,
                                         acctType=0)

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/93932756/test/integration/component/test_cpu_domain_limits.py
----------------------------------------------------------------------
diff --git a/test/integration/component/test_cpu_domain_limits.py b/test/integration/component/test_cpu_domain_limits.py
index c427e4f..cd2ab54 100644
--- a/test/integration/component/test_cpu_domain_limits.py
+++ b/test/integration/component/test_cpu_domain_limits.py
@@ -236,7 +236,7 @@ class TestDomainCPULimitsUpdateResources(cloudstackTestCase):
             self.account = admin
             self.domain = domain
 
-            api_client = self.testClient.createUserApiClient(
+            api_client = self.testClient.getUserApiClient(
                 UserName=self.account.name,
                 DomainName=self.account.domain)
 
@@ -309,7 +309,7 @@ class TestDomainCPULimitsUpdateResources(cloudstackTestCase):
             self.account = admin
             self.domain = domain
 
-            api_client = self.testClient.createUserApiClient(
+            api_client = self.testClient.getUserApiClient(
                 UserName=self.account.name,
                 DomainName=self.account.domain)
 
@@ -368,7 +368,7 @@ class TestDomainCPULimitsUpdateResources(cloudstackTestCase):
             self.account = admin
             self.domain = domain
 
-            api_client = self.testClient.createUserApiClient(
+            api_client = self.testClient.getUserApiClient(
                 UserName=self.account.name,
                 DomainName=self.account.domain)
 
@@ -432,7 +432,7 @@ class TestDomainCPULimitsUpdateResources(cloudstackTestCase):
             self.account = admin
             self.domain = domain
 
-            api_client = self.testClient.createUserApiClient(
+            api_client = self.testClient.getUserApiClient(
                 UserName=self.account.name,
                 DomainName=self.account.domain)
 
@@ -684,11 +684,11 @@ class TestMultipleChildDomains(cloudstackTestCase):
         self.debug("Setting up account and domain hierarchy")
         self.setupAccounts()
 
-        api_client_cadmin_1 = self.testClient.createUserApiClient(
+        api_client_cadmin_1 = self.testClient.getUserApiClient(
             UserName=self.cadmin_1.name,
             DomainName=self.cadmin_1.domain)
 
-        api_client_cadmin_2 = self.testClient.createUserApiClient(
+        api_client_cadmin_2 = self.testClient.getUserApiClient(
             UserName=self.cadmin_2.name,
             DomainName=self.cadmin_2.domain)
 

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/93932756/test/integration/component/test_cpu_limits.py
----------------------------------------------------------------------
diff --git a/test/integration/component/test_cpu_limits.py b/test/integration/component/test_cpu_limits.py
index bdf2869..c6d8d14 100644
--- a/test/integration/component/test_cpu_limits.py
+++ b/test/integration/component/test_cpu_limits.py
@@ -478,7 +478,7 @@ class TestDomainCPULimitsConfiguration(cloudstackTestCase):
             self.account = admin
             self.domain = domain
 
-        api_client = self.testClient.createUserApiClient(
+        api_client = self.testClient.getUserApiClient(
             UserName=self.account.name,
             DomainName=self.account.domain)
 
@@ -550,7 +550,7 @@ class TestDomainCPULimitsConfiguration(cloudstackTestCase):
             self.account = admin
             self.domain = domain
 
-        api_client = self.testClient.createUserApiClient(
+        api_client = self.testClient.getUserApiClient(
             UserName=self.account.name,
             DomainName=self.account.domain)
 
@@ -608,7 +608,7 @@ class TestDomainCPULimitsConfiguration(cloudstackTestCase):
             self.account = admin
             self.domain = domain
 
-        api_client = self.testClient.createUserApiClient(
+        api_client = self.testClient.getUserApiClient(
             UserName=self.account.name,
             DomainName=self.account.domain)
 
@@ -680,7 +680,7 @@ class TestDomainCPULimitsConfiguration(cloudstackTestCase):
             if cpu_account_gc[0].max != 16:
                 self.skipTest("This test case requires configuration value max.account.cpus to be 16")
 
-            api_client = self.testClient.createUserApiClient(
+            api_client = self.testClient.getUserApiClient(
                 UserName=self.account.name,
                 DomainName=self.account.domain)
 

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/93932756/test/integration/component/test_cpu_max_limits.py
----------------------------------------------------------------------
diff --git a/test/integration/component/test_cpu_max_limits.py b/test/integration/component/test_cpu_max_limits.py
index 317df16..afbfcb4 100644
--- a/test/integration/component/test_cpu_max_limits.py
+++ b/test/integration/component/test_cpu_max_limits.py
@@ -251,7 +251,7 @@ class TestMaxCPULimits(cloudstackTestCase):
         self.debug("Setting up account and domain hierarchy")
         self.setupAccounts(account_limit=4, domain_limit=2)
 
-        api_client_admin = self.testClient.createUserApiClient(
+        api_client_admin = self.testClient.getUserApiClient(
             UserName=self.child_do_admin.name,
             DomainName=self.child_do_admin.domain)
 
@@ -284,7 +284,7 @@ class TestMaxCPULimits(cloudstackTestCase):
         self.debug("Setting up account and domain hierarchy")
         self.setupAccounts(account_limit=6, domain_limit=8)
 
-        api_client_admin = self.testClient.createUserApiClient(
+        api_client_admin = self.testClient.getUserApiClient(
             UserName=self.child_do_admin.name,
             DomainName=self.child_do_admin.domain)
 
@@ -325,7 +325,7 @@ class TestMaxCPULimits(cloudstackTestCase):
         self.debug("Setting up account and domain hierarchy")
         self.setupAccounts(account_limit=4, domain_limit=4, project_limit=2)
 
-        api_client_admin = self.testClient.createUserApiClient(
+        api_client_admin = self.testClient.getUserApiClient(
             UserName=self.child_do_admin.name,
             DomainName=self.child_do_admin.domain)
 
@@ -360,7 +360,7 @@ class TestMaxCPULimits(cloudstackTestCase):
         self.debug("Setting up account and domain hierarchy")
         self.setupAccounts(account_limit=6, domain_limit=6, project_limit=6)
 
-        api_client_admin = self.testClient.createUserApiClient(
+        api_client_admin = self.testClient.getUserApiClient(
             UserName=self.child_do_admin.name,
             DomainName=self.child_do_admin.domain)
 

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/93932756/test/integration/component/test_cpu_project_limits.py
----------------------------------------------------------------------
diff --git a/test/integration/component/test_cpu_project_limits.py b/test/integration/component/test_cpu_project_limits.py
index a8a1b3c..a81c70a 100644
--- a/test/integration/component/test_cpu_project_limits.py
+++ b/test/integration/component/test_cpu_project_limits.py
@@ -136,7 +136,7 @@ class TestProjectsCPULimits(cloudstackTestCase):
         self.debug("Setting up account and domain hierarchy")
         self.setupProjectAccounts()
 
-        api_client = self.testClient.createUserApiClient(
+        api_client = self.testClient.getUserApiClient(
             UserName=self.admin.name,
             DomainName=self.admin.domain)
 

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/93932756/test/integration/component/test_memory_limits.py
----------------------------------------------------------------------
diff --git a/test/integration/component/test_memory_limits.py b/test/integration/component/test_memory_limits.py
index 7921e4b..84af4b1 100644
--- a/test/integration/component/test_memory_limits.py
+++ b/test/integration/component/test_memory_limits.py
@@ -495,7 +495,7 @@ class TestDomainMemoryLimitsConfiguration(cloudstackTestCase):
             self.account = admin
             self.domain = domain
 
-            api_client = self.testClient.createUserApiClient(
+            api_client = self.testClient.getUserApiClient(
                              UserName=self.account.name,
                              DomainName=self.account.domain)
 
@@ -567,7 +567,7 @@ class TestDomainMemoryLimitsConfiguration(cloudstackTestCase):
             self.account = admin
             self.domain = domain
 
-            api_client = self.testClient.createUserApiClient(
+            api_client = self.testClient.getUserApiClient(
                              UserName=self.account.name,
                              DomainName=self.account.domain)
 
@@ -625,7 +625,7 @@ class TestDomainMemoryLimitsConfiguration(cloudstackTestCase):
             self.account = admin
             self.domain = domain
 
-            api_client = self.testClient.createUserApiClient(
+            api_client = self.testClient.getUserApiClient(
                              UserName=self.account.name,
                              DomainName=self.account.domain)
 
@@ -698,7 +698,7 @@ class TestDomainMemoryLimitsConfiguration(cloudstackTestCase):
             if memory_account_gc[0].max != 8192:
                 self.skipTest("This test case requires configuration value max.account.memory to be 8192")
 
-	        api_client = self.testClient.createUserApiClient(
+	        api_client = self.testClient.getUserApiClient(
                              UserName=self.account.name,
                              DomainName=self.account.domain)
 

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/93932756/test/integration/component/test_mm_domain_limits.py
----------------------------------------------------------------------
diff --git a/test/integration/component/test_mm_domain_limits.py b/test/integration/component/test_mm_domain_limits.py
index 68660c1..a6c4de8 100644
--- a/test/integration/component/test_mm_domain_limits.py
+++ b/test/integration/component/test_mm_domain_limits.py
@@ -233,7 +233,7 @@ class TestDomainMemoryLimits(cloudstackTestCase):
             self.debug("Creating an instance with service offering: %s" %
                                                     self.service_offering.name)
 
-            api_client = self.testClient.createUserApiClient(
+            api_client = self.testClient.getUserApiClient(
                             UserName=self.account.name,
                             DomainName=self.account.domain)
 
@@ -370,7 +370,7 @@ class TestDomainMemoryLimits(cloudstackTestCase):
             self.debug("Creating an instance with service offering: %s" %
                                                     self.service_offering.name)
 
-            api_client = self.testClient.createUserApiClient(
+            api_client = self.testClient.getUserApiClient(
                             UserName=self.account.name,
                             DomainName=self.account.domain)
 
@@ -429,7 +429,7 @@ class TestDomainMemoryLimits(cloudstackTestCase):
             self.debug("Creating an instance with service offering: %s" %
                                                     self.service_offering.name)
 
-            api_client = self.testClient.createUserApiClient(
+            api_client = self.testClient.getUserApiClient(
                             UserName=self.account.name,
                             DomainName=self.account.domain)
 
@@ -489,7 +489,7 @@ class TestDomainMemoryLimits(cloudstackTestCase):
             self.debug("Creating an instance with service offering: %s" %
                                                     self.service_offering.name)
 
-            api_client = self.testClient.createUserApiClient(
+            api_client = self.testClient.getUserApiClient(
                             UserName=self.account.name,
                             DomainName=self.account.domain)
 
@@ -706,11 +706,11 @@ class TestMultipleChildDomainsMemory(cloudstackTestCase):
         self.debug("Setting up account and domain hierarchy")
         self.setupAccounts()
 
-        api_client_cadmin_1 = self.testClient.createUserApiClient(
+        api_client_cadmin_1 = self.testClient.getUserApiClient(
                             UserName=self.cadmin_1.name,
                             DomainName=self.cadmin_1.domain)
 
-        api_client_cadmin_2 = self.testClient.createUserApiClient(
+        api_client_cadmin_2 = self.testClient.getUserApiClient(
                             UserName=self.cadmin_2.name,
                             DomainName=self.cadmin_2.domain)
 

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/93932756/test/integration/component/test_mm_max_limits.py
----------------------------------------------------------------------
diff --git a/test/integration/component/test_mm_max_limits.py b/test/integration/component/test_mm_max_limits.py
index e10c119..df29ea9 100644
--- a/test/integration/component/test_mm_max_limits.py
+++ b/test/integration/component/test_mm_max_limits.py
@@ -253,7 +253,7 @@ class TestMaxMemoryLimits(cloudstackTestCase):
         self.debug("Setting up account and domain hierarchy")
         self.setupAccounts(account_limit=8, domain_limit=4)
 
-        api_client = self.testClient.createUserApiClient(
+        api_client = self.testClient.getUserApiClient(
                             UserName=self.child_do_admin.name,
                             DomainName=self.child_do_admin.domain)
 
@@ -280,7 +280,7 @@ class TestMaxMemoryLimits(cloudstackTestCase):
         self.debug("Setting up account and domain hierarchy")
         self.setupAccounts(account_limit=7, domain_limit=14)
 
-        api_client = self.testClient.createUserApiClient(
+        api_client = self.testClient.getUserApiClient(
                             UserName=self.child_do_admin.name,
                             DomainName=self.child_do_admin.domain)
 
@@ -310,7 +310,7 @@ class TestMaxMemoryLimits(cloudstackTestCase):
         self.debug("Setting up account and domain hierarchy")
         self.setupAccounts(account_limit=8,domain_limit=8, project_limit=4)
 
-        api_client = self.testClient.createUserApiClient(
+        api_client = self.testClient.getUserApiClient(
                             UserName=self.child_do_admin.name,
                             DomainName=self.child_do_admin.domain)
 
@@ -334,7 +334,7 @@ class TestMaxMemoryLimits(cloudstackTestCase):
         self.debug("Setting up account and domain hierarchy")
         self.setupAccounts(account_limit=6, project_limit=12, domain_limit=12)
 
-        api_client = self.testClient.createUserApiClient(
+        api_client = self.testClient.getUserApiClient(
                             UserName=self.child_do_admin.name,
                             DomainName=self.child_do_admin.domain)
 

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/93932756/test/integration/component/test_mm_project_limits.py
----------------------------------------------------------------------
diff --git a/test/integration/component/test_mm_project_limits.py b/test/integration/component/test_mm_project_limits.py
index c314011..d030692 100644
--- a/test/integration/component/test_mm_project_limits.py
+++ b/test/integration/component/test_mm_project_limits.py
@@ -136,7 +136,7 @@ class TestProjectsMemoryLimits(cloudstackTestCase):
         self.debug("Setting up account and domain hierarchy")
         self.setupProjectAccounts()
 
-        api_client = self.testClient.createUserApiClient(
+        api_client = self.testClient.getUserApiClient(
                             UserName=self.admin.name,
                             DomainName=self.admin.domain)
 

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/93932756/test/integration/component/test_portable_ip.py
----------------------------------------------------------------------
diff --git a/test/integration/component/test_portable_ip.py b/test/integration/component/test_portable_ip.py
index d397ec4..8c65214 100644
--- a/test/integration/component/test_portable_ip.py
+++ b/test/integration/component/test_portable_ip.py
@@ -221,7 +221,7 @@ class TestCreatePortablePublicIpRanges(cloudstackTestCase):
                             domainid=self.domain.id
                             )
 
-        self.api_client_user = self.testClient.createUserApiClient(
+        self.api_client_user = self.testClient.getUserApiClient(
                                             UserName=self.account.name,
                                             DomainName=self.account.domain
                                             )
@@ -361,7 +361,7 @@ class TestDeletePortablePublicIpRanges(cloudstackTestCase):
 
         self.cleanup.append(self.account)
 
-        self.api_client_user = self.testClient.createUserApiClient(
+        self.api_client_user = self.testClient.getUserApiClient(
                                             UserName=self.account.name,
                                             DomainName=self.account.domain
                                             )
@@ -552,7 +552,7 @@ class TestListPortablePublicIpRanges(cloudstackTestCase):
 
         self.cleanup.append(self.account)
 
-        self.api_client_user = self.testClient.createUserApiClient(
+        self.api_client_user = self.testClient.getUserApiClient(
                                             UserName=self.account.name,
                                             DomainName=self.account.domain
                                             )
@@ -1110,7 +1110,7 @@ class TestDisassociatePublicIp(cloudstackTestCase):
                             domainid=self.domain.id
                             )
 
-        self.api_client_user = self.testClient.createUserApiClient(
+        self.api_client_user = self.testClient.getUserApiClient(
                                             UserName=self.user_account.name,
                                             DomainName=self.user_account.domain
                                             )

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/93932756/test/integration/component/test_vpc.py
----------------------------------------------------------------------
diff --git a/test/integration/component/test_vpc.py b/test/integration/component/test_vpc.py
index 1af8d81..ab3b5ab 100644
--- a/test/integration/component/test_vpc.py
+++ b/test/integration/component/test_vpc.py
@@ -1934,7 +1934,7 @@ class TestVPC(cloudstackTestCase):
         self.debug("creating a VPC network in the account: %s" %
                                                     user.name)
 
-        userapiclient = self.testClient.createUserApiClient(
+        userapiclient = self.testClient.getUserApiClient(
                                         UserName=user.name,
                                         DomainName=user.domain,
                                         acctType=0)

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/93932756/test/integration/component/test_vpn_users.py
----------------------------------------------------------------------
diff --git a/test/integration/component/test_vpn_users.py b/test/integration/component/test_vpn_users.py
index 02dd026..d76cbf8 100644
--- a/test/integration/component/test_vpn_users.py
+++ b/test/integration/component/test_vpn_users.py
@@ -396,7 +396,7 @@ class TestVPNUsers(cloudstackTestCase):
                                domainid=self.account.domainid)
         self.cleanup.append(admin)
         self.debug("Creating API client for newly created user")
-        api_client = self.testClient.createUserApiClient(
+        api_client = self.testClient.getUserApiClient(
                                     UserName=self.account.name,
                                     DomainName=self.account.domain)
 
@@ -438,7 +438,7 @@ class TestVPNUsers(cloudstackTestCase):
                                domainid=self.account.domainid)
         self.cleanup.append(admin)
         self.debug("Creating API client for newly created user")
-        api_client = self.testClient.createUserApiClient(
+        api_client = self.testClient.getUserApiClient(
                                     UserName=self.account.name,
                                     DomainName=self.account.domain)
 

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/93932756/test/integration/smoke/test_affinity_groups.py
----------------------------------------------------------------------
diff --git a/test/integration/smoke/test_affinity_groups.py b/test/integration/smoke/test_affinity_groups.py
index c96a580..0f8bdc4 100644
--- a/test/integration/smoke/test_affinity_groups.py
+++ b/test/integration/smoke/test_affinity_groups.py
@@ -70,7 +70,9 @@ class TestDeployVmWithAffinityGroup(cloudstackTestCase):
 
     @classmethod
     def setUpClass(cls):
-        cls.api_client = super(TestDeployVmWithAffinityGroup, cls).getClsTestClient().getApiClient()
+        cls.test_client = super(TestDeployVmWithAffinityGroup, cls).getClsTestClient()
+        zone_name = cls.test_client.getZoneForTests() 
+        cls.api_client = cls.test_client.getApiClient()
         cls.services = Services().services
         # Get Zone, Domain and templates
         cls.domain = get_domain(cls.api_client, cls.services)

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/93932756/test/integration/smoke/test_deploy_vm.py
----------------------------------------------------------------------
diff --git a/test/integration/smoke/test_deploy_vm.py b/test/integration/smoke/test_deploy_vm.py
index 425aeb7..4104386 100644
--- a/test/integration/smoke/test_deploy_vm.py
+++ b/test/integration/smoke/test_deploy_vm.py
@@ -153,4 +153,4 @@ class TestDeployVM(cloudstackTestCase):
         try:
             cleanup_resources(self.apiclient, self.cleanup)
         except Exception as e:
-            self.debug("Warning! Exception in tearDown: %s" % e)
\ No newline at end of file
+            self.debug("Warning! Exception in tearDown: %s" % e)

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/93932756/test/integration/smoke/test_deploy_vm_with_userdata.py
----------------------------------------------------------------------
diff --git a/test/integration/smoke/test_deploy_vm_with_userdata.py b/test/integration/smoke/test_deploy_vm_with_userdata.py
index e3788cf..85e768e 100644
--- a/test/integration/smoke/test_deploy_vm_with_userdata.py
+++ b/test/integration/smoke/test_deploy_vm_with_userdata.py
@@ -92,7 +92,7 @@ class TestDeployVmWithUserData(cloudstackTestCase):
         user_data = ''.join(random.choice(string.ascii_uppercase + string.digits) for x in range(2500))
         cls.services["virtual_machine"]["userdata"] = user_data
 
-    @attr(tags=["simulator", "devcloud", "basic", "advanced"])
+    @attr(tags=["simulator", "devcloud", "basic", "advanced", "post"])
     def test_deployvm_userdata_post(self):
         """Test userdata as POST, size > 2k
         """

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/93932756/tools/marvin/marvin/asyncJobMgr.py
----------------------------------------------------------------------
diff --git a/tools/marvin/marvin/asyncJobMgr.py b/tools/marvin/marvin/asyncJobMgr.py
index e24170e..dab85ca 100644
--- a/tools/marvin/marvin/asyncJobMgr.py
+++ b/tools/marvin/marvin/asyncJobMgr.py
@@ -62,7 +62,7 @@ class workThread(threading.Thread):
         try:
             self.lock.acquire()
             result = self.connection.poll(job.jobId, job.responsecls).jobresult
-        except cloudstackException.cloudstackAPIException, e:
+        except cloudstackException.CloudstackAPIException, e:
             result = str(e)
         finally:
             self.lock.release()
@@ -102,7 +102,7 @@ class workThread(threading.Thread):
                     except:
                         pass
                     jobstatus.status = True
-        except cloudstackException.cloudstackAPIException, e:
+        except cloudstackException.CloudstackAPIException, e:
             jobstatus.result = str(e)
             jobstatus.status = False
         except:

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/93932756/tools/marvin/marvin/cloudstackConnection.py
----------------------------------------------------------------------
diff --git a/tools/marvin/marvin/cloudstackConnection.py b/tools/marvin/marvin/cloudstackConnection.py
index fb03e3b..8413ac0 100644
--- a/tools/marvin/marvin/cloudstackConnection.py
+++ b/tools/marvin/marvin/cloudstackConnection.py
@@ -21,21 +21,33 @@ import base64
 import hmac
 import hashlib
 import time
-import cloudstackException
 from cloudstackAPI import *
 import jsonHelper
+from codes import (
+    FAILED,
+    INVALID_RESPONSE,
+    INVALID_INPUT,
+    JOB_FAILED,
+    JOB_INPROGRESS,
+    JOB_CANCELLED,
+    JOB_SUCCEEDED
+)
 from requests import (
     ConnectionError,
     HTTPError,
     Timeout,
     RequestException
-    )
+)
+from cloudstackException import GetDetailExceptionInfo
 
 
-class cloudConnection(object):
-
-    """ Connections to make API calls to the cloudstack management server
-    """
+class CSConnection(object):
+    '''
+    @Desc: Connection Class to make API\Command calls to the
+           CloudStack Management Server
+           Sends the GET\POST requests to CS based upon the
+           information provided and retrieves the parsed response.
+    '''
     def __init__(self, mgmtDet, asyncTimeout=3600, logger=None,
                  path='client/api'):
         self.apiKey = mgmtDet.apiKey
@@ -44,68 +56,79 @@ class cloudConnection(object):
         self.port = mgmtDet.port
         self.user = mgmtDet.user
         self.passwd = mgmtDet.passwd
-        self.certCAPath = mgmtDet.certCAPath
-        self.certPath = mgmtDet.certPath
+        if mgmtDet.certCAPath != "NA" and mgmtDet.certPath != "NA":
+            self.certPath = (mgmtDet.certCAPath, mgmtDet.certPath)
+        else:
+            self.certPath = ()
         self.logger = logger
         self.path = path
         self.retries = 5
         self.mgtDetails = mgmtDet
-        self.protocol = "http"
         self.asyncTimeout = asyncTimeout
         self.auth = True
         if self.port == 8096 or \
            (self.apiKey is None and self.securityKey is None):
             self.auth = False
-        if mgmtDet.useHttps == "True":
-            self.protocol = "https"
-        self.baseurl = "%s://%s:%d/%s"\
+        self.protocol = "https" if mgmtDet.useHttps == "True" else "http"
+        self.httpsFlag = True if self.protocol == "https" else False
+        self.baseUrl = "%s://%s:%d/%s"\
                        % (self.protocol, self.mgtSvr, self.port, self.path)
 
     def __copy__(self):
-        return cloudConnection(self.mgtDetails,
-                               self.asyncTimeout,
-                               self.logger,
-                               self.path)
-
-    def poll(self, jobid, response):
-        """
-        polls the completion of a given jobid
-        @param jobid:
-        @param response:
-        @return:
-        """
-        cmd = queryAsyncJobResult.queryAsyncJobResultCmd()
-        cmd.jobid = jobid
-        timeout = self.asyncTimeout
-
-        while timeout > 0:
-            asyncResonse = self.marvinRequest(cmd, response_type=response)
+        return CSConnection(self.mgtDetails,
+                            self.asyncTimeout,
+                            self.logger,
+                            self.path)
 
-            if asyncResonse.jobstatus == 2:
-                raise cloudstackException.cloudstackAPIException(
-                    "asyncquery", asyncResonse.jobresult)
-            elif asyncResonse.jobstatus == 1:
-                return asyncResonse
-
-            time.sleep(5)
-            if self.logger is not None:
-                self.logger.debug("job: %s still processing,"
-                                  "will timeout in %ds" % (jobid, timeout))
-            timeout = timeout - 5
+    def __poll(self, jobid, response_cmd):
+        '''
+        @Desc: polls for the completion of a given jobid
+        @param 1. jobid: Monitor the Jobid for CS
+               2. response_cmd:response command for request cmd
+        @return: FAILED if jobid is cancelled,failed
+                 Else return async_response
+        '''
+        try:
+            cmd = queryAsyncJobResult.queryAsyncJobResultCmd()
+            cmd.jobid = jobid
+            timeout = self.asyncTimeout
 
-        raise cloudstackException.cloudstackAPIException(
-            "asyncquery", "Async job timeout %s" % jobid)
+            while timeout > 0:
+                async_response = self.\
+                    marvinRequest(cmd, response_type=response_cmd)
+                if async_response != FAILED:
+                    job_status = async_response.jobstatus
+                    if job_status in [JOB_FAILED, JOB_CANCELLED]:
+                        self.logger.debug("=====JobId:%s Either "
+                                          "got Cancelled or Failed======"
+                                          % (str(jobid)))
+                        return FAILED
+                    if job_status == JOB_SUCCEEDED:
+                        self.logger.debug("======JobId:%s Succeeded====="
+                                          % (str(jobid)))
+                        return async_response
+                time.sleep(5)
+                timeout -= 5
+                self.logger.debug("JobId:%s is Still Processing, "
+                                  "Will TimeOut in:%s" % (str(jobid),
+                                                          str(timeout)))
+            return FAILED
+        except Exception, e:
+            self.logger.exception("__poll: Exception Occurred :%s" %
+                                  GetDetailExceptionInfo(e))
+            return FAILED
 
-    def sign(self, payload):
+    def __sign(self, payload):
         """
-        signs a given request URL when the apiKey and secretKey are known
-
+        @Name : __sign
+        @Desc:signs a given request URL when the apiKey and
+              secretKey are known
         @param payload: dict of GET params to be signed
         @return: the signature of the payload
         """
         params = zip(payload.keys(), payload.values())
         params.sort(key=lambda k: str.lower(k[0]))
-        hashStr = "&".join(
+        hash_str = "&".join(
             ["=".join(
                 [str.lower(r[0]),
                  str.lower(
@@ -114,168 +137,209 @@ class cloudConnection(object):
             ) for r in params]
         )
         signature = base64.encodestring(hmac.new(
-            self.securityKey, hashStr, hashlib.sha1).digest()).strip()
-        self.logger.debug("Computed Signature by Marvin: %s" % signature)
+            self.securityKey, hash_str, hashlib.sha1).digest()).strip()
         return signature
 
-    def request(self, command, auth=True, payload={}, method='GET'):
+    def __sendPostReqToCS(self, url, payload):
+        '''
+        @Name : __sendPostReqToCS
+        @Desc : Sends the POST Request to CS
+        @Input : url: URL to send post req
+                 payload:Payload information as part of request
+        '''
+        try:
+            response = requests.post(url,
+                                     params=payload,
+                                     cert=self.certPath,
+                                     verify=self.httpsFlag)
+            return response
+        except Exception, e:
+            self.logger.\
+                exception("__sendPostReqToCS : Exception "
+                          "Occurred: %s" % GetDetailExceptionInfo(e))
+            return FAILED
+
+    def __sendGetReqToCS(self, url, payload):
+        '''
+        @Name : __sendGetReqToCS
+        @Desc : Sends the GET Request to CS
+        @Input : url: URL to send post req
+                 payload:Payload information as part of request
+        '''
+        try:
+            response = requests.get(url,
+                                    params=payload,
+                                    cert=self.certPath,
+                                    verify=self.httpsFlag)
+            return response
+        except Exception, e:
+            self.logger.exception("__sendGetReqToCS : Exception Occurred: %s" %
+                                  GetDetailExceptionInfo(e))
+            return FAILED
+
+    def __sendCmdToCS(self, command, auth=True, payload={}, method='GET'):
         """
-        Makes requests using auth or over integration port
+        @Name : __sendCmdToCS
+        @Desc : Makes requests to CS using the Inputs provided
         @param command: cloudstack API command name
                     eg: deployVirtualMachineCommand
         @param auth: Authentication (apikey,secretKey) => True
                      else False for integration.api.port
         @param payload: request data composed as a dictionary
         @param method: GET/POST via HTTP
-        @return:
+        @output: FAILED or else response from CS
         """
-        payload["command"] = command
-        payload["response"] = "json"
-
-        if auth:
-            payload["apiKey"] = self.apiKey
-            signature = self.sign(payload)
-            payload["signature"] = signature
-
         try:
-            #https_flag : Signifies whether to verify connection over \
-            #http or https, \
-            #initialized to False, will be set to true if user provided https
-            #connection
-            https_flag = False
-            cert_path = ()
-            if self.protocol == "https":
-                https_flag = True
-                if self.certCAPath != "NA" and self.certPath != "NA":
-                    cert_path = (self.certCAPath, self.certPath)
+            payload["command"] = command
+            payload["response"] = "json"
+
+            if auth:
+                payload["apiKey"] = self.apiKey
+                payload["signature"] = self.__sign(payload)
 
             #Verify whether protocol is "http", then call the request over http
             if self.protocol == "http":
+                self.logger.debug("Payload: %s" % str(payload))
                 if method == 'POST':
-                    response = requests.post(self.baseurl, params=payload,
-                                             verify=https_flag)
-                else:
-                    response = requests.get(self.baseurl, params=payload,
-                                            verify=https_flag)
+                    self.logger.debug("=======Sending POST Cmd : %s======="
+                                      % str(command))
+                    return self.__sendPostReqToCS(self.baseUrl, payload)
+                if method == "GET":
+                    self.logger.debug("========Sending GET Cmd : %s======="
+                                      % str(command))
+                    return self.__sendGetReqToCS(self.baseUrl, payload)
             else:
-                '''
-                If protocol is https, then create the  connection url with \
-                user provided certificates \
-                provided as part of cert
-                '''
-                try:
-                    if method == 'POST':
-                        response = requests.post(self.baseurl,
-                                                 params=payload,
-                                                 cert=cert_path,
-                                                 verify=https_flag)
-                    else:
-                        response = requests.get(self.baseurl, params=payload,
-                                                cert=cert_path,
-                                                verify=https_flag)
-                except Exception, e:
-                    '''
-                    If an exception occurs with user provided CA certs, \
-                    then try with default certs, \
-                    we dont need to mention here the cert path
-                    '''
-                    self.logger.debug("Creating CS connection over https \
-                                        didnt worked with user provided certs \
-                                            , so trying with no certs %s" % e)
-                    if method == 'POST':
-                        response = requests.post(self.baseurl,
-                                                 params=payload,
-                                                 verify=https_flag)
-                    else:
-                        response = requests.get(self.baseurl,
-                                                params=payload,
-                                                verify=https_flag)
-        except ConnectionError, c:
-            self.logger.debug("Connection refused. Reason: %s : %s" %
-                              (self.baseurl, c))
-            raise c
-        except HTTPError, h:
-            self.logger.debug("Http Error.Server returned error code: %s" % h)
-            raise h
-        except Timeout, t:
-            self.logger.debug("Connection timed out with %s" % t)
-            raise t
-        except RequestException, r:
-            self.logger.debug("RequestException from server %s" % r)
-            raise r
+                self.logger.exception("__sendCmdToCS: Invalid Protocol")
+                return FAILED
         except Exception, e:
-            self.logger.debug("Error returned by server %s" % r)
-            raise e
-        else:
-            return response
+            self.logger.exception("__sendCmdToCS: Exception:%s" %
+                                  GetDetailExceptionInfo(e))
+            return FAILED
 
-    def sanitizeCommand(self, cmd):
+    def __sanitizeCmd(self, cmd):
         """
-        Removes None values, Validates all required params are present
+        @Name : __sanitizeCmd
+        @Desc : Removes None values, Validates all required params are present
         @param cmd: Cmd object eg: createPhysicalNetwork
-        @return:
+        @Output: Returns command name, asynchronous or not , request payload
+                 INVALID_INPUT if cmd is invalid
         """
-        requests = {}
-        required = []
-        for attribute in dir(cmd):
-            if not attribute.startswith('__'):
-                if attribute == "isAsync":
-                    isAsync = getattr(cmd, attribute)
-                elif attribute == "required":
-                    required = getattr(cmd, attribute)
-                else:
-                    requests[attribute] = getattr(cmd, attribute)
-
-        cmdname = cmd.__class__.__name__.replace("Cmd", "")
-        for requiredPara in required:
-            if requests[requiredPara] is None:
-                raise cloudstackException.cloudstackAPIException(
-                    cmdname, "%s is required" % requiredPara)
-        for param, value in requests.items():
-            if value is None:
-                requests.pop(param)
-            elif isinstance(value, list):
-                if len(value) == 0:
-                    requests.pop(param)
-                else:
-                    if not isinstance(value[0], dict):
-                        requests[param] = ",".join(value)
+        try:
+            cmd_name = ''
+            payload = {}
+            required = []
+            for attribute in dir(cmd):
+                if not attribute.startswith('__'):
+                    if attribute == "isAsync":
+                        isAsync = getattr(cmd, attribute)
+                    elif attribute == "required":
+                        required = getattr(cmd, attribute)
                     else:
-                        requests.pop(param)
-                        i = 0
-                        for val in value:
-                            for k, v in val.iteritems():
-                                requests["%s[%d].%s" % (param, i, k)] = v
-                            i = i + 1
-        return cmdname.strip(), isAsync, requests
+                        payload[attribute] = getattr(cmd, attribute)
+            cmd_name = cmd.__class__.__name__.replace("Cmd", "")
+            for required_param in required:
+                if payload[required_param] is None:
+                    self.logger.debug("CmdName: %s Parameter : %s is Required"
+                                      % (cmd_name, required_param))
+                    return INVALID_INPUT
+            for param, value in payload.items():
+                if value is None:
+                    payload.pop(param)
+                elif isinstance(value, list):
+                    if len(value) == 0:
+                        payload.pop(param)
+                    else:
+                        if not isinstance(value[0], dict):
+                            payload[param] = ",".join(value)
+                        else:
+                            payload.pop(param)
+                            i = 0
+                            for val in value:
+                                for k, v in val.iteritems():
+                                    payload["%s[%d].%s" % (param, i, k)] = v
+                                i += 1
+
+            return cmd_name.strip(), isAsync, payload
+        except Exception, e:
+            self.logger.\
+                exception("__sanitizeCmd: CmdName : "
+                          "%s : Exception:%s" % (cmd_name,
+                                                 GetDetailExceptionInfo(e)))
+            return FAILED
+
+    def __parseAndGetResponse(self, cmd_response, response_cls, is_async):
+        '''
+        @Name : __parseAndGetResponse
+        @Desc : Verifies the  Response(from CS) and returns an
+                appropriate json parsed Response
+        @Output:
+        '''
+        if cmd_response == FAILED:
+            return FAILED
+        try:
+            ret = jsonHelper.getResultObj(cmd_response.json(), response_cls)
+        except TypeError:
+            ret = jsonHelper.getResultObj(cmd_response.json, response_cls)
+
+        '''
+        If the response is asynchronous, poll and return response
+        else return response as it is
+        '''
+        if is_async == "false":
+            self.logger.debug("Response : %s" % str(ret))
+            return ret
+        else:
+            response = self.__poll(ret.jobid, response_cls)
+            self.logger.debug("Response : %s" % str(response))
+            return response.jobresult if response != FAILED else FAILED
 
     def marvinRequest(self, cmd, response_type=None, method='GET', data=''):
         """
-        Requester for marvin command objects
+        @Name : marvinRequest
+        @Desc: Handles Marvin Requests
         @param cmd: marvin's command from cloudstackAPI
         @param response_type: response type of the command in cmd
         @param method: HTTP GET/POST, defaults to GET
-        @return:
+        @return: Response received from CS
+                 FAILED In case of Error\Exception
         """
-        cmdname, isAsync, payload = self.sanitizeCommand(cmd)
-        self.logger.debug("sending %s request: %s %s" % (method, cmdname,
-                                                         str(payload)))
-        response = self.request(cmdname,
-                                self.auth,
-                                payload=payload,
-                                method=method)
-        if response is None:
-            return None
-        self.logger.debug("Request: %s Response: %s" % (response.url,
-                                                        response.text))
         try:
-            response = jsonHelper.getResultObj(response.json(), response_type)
-        except TypeError:
-            response = jsonHelper.getResultObj(response.json, response_type)
+            '''
+            1. Verify the Inputs Provided
+            '''
+            if (cmd is None or cmd == '')or \
+                    (response_type is None or response_type == ''):
+                self.logger.exception("marvinRequest : Invalid Command Input")
+                return FAILED
 
-        if isAsync == "false":
-            return response
-        else:
-            asyncJobId = response.jobid
-            response = self.poll(asyncJobId, response_type)
-            return response.jobresult
+            '''
+            2. Sanitize the Command
+            '''
+            if self.__sanitizeCmd(cmd) != INVALID_INPUT:
+                cmd_name, is_async, payload = self.__sanitizeCmd(cmd)
+            else:
+                self.logger.exception("marvinRequest : Cmd: "
+                                      "Sanitizing Command Failed")
+                return FAILED
+
+            '''
+            3. Send Command to CS
+            '''
+            cmd_response = self.__sendCmdToCS(cmd_name,
+                                              self.auth,
+                                              payload=payload,
+                                              method=method)
+            if cmd_response == FAILED:
+                return FAILED
+
+            '''
+            4. Check if the Command Response received above is valid or Not.
+               If not return Invalid Response
+            '''
+            return self.__parseAndGetResponse(cmd_response,
+                                              response_type,
+                                              is_async)
+        except Exception, e:
+            self.logger.exception("marvinRequest : CmdName: %s Exception: %s" %
+                                  (str(cmd), GetDetailExceptionInfo(e)))
+            return FAILED

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/93932756/tools/marvin/marvin/cloudstackException.py
----------------------------------------------------------------------
diff --git a/tools/marvin/marvin/cloudstackException.py b/tools/marvin/marvin/cloudstackException.py
index 6200003..3da28b7 100644
--- a/tools/marvin/marvin/cloudstackException.py
+++ b/tools/marvin/marvin/cloudstackException.py
@@ -15,8 +15,12 @@
 # specific language governing permissions and limitations
 # under the License.
 
+import sys
+import traceback
+from marvin.codes import (INVALID_INPUT, EXCEPTION_OCCURRED)
 
-class cloudstackAPIException(Exception):
+
+class CloudstackAPIException(Exception):
     def __init__(self, cmd="", result=""):
         self.errorMsg = "Execute cmd: %s failed, due to: %s" % (cmd, result)
 
@@ -46,3 +50,12 @@ class internalError(Exception):
 
     def __str__(self):
         return self.errorMsg
+
+
+def GetDetailExceptionInfo(e):
+    if e is not None:
+        exc_type, exc_value, exc_traceback = sys.exc_info()
+        return str(repr(traceback.format_exception(
+            exc_type, exc_value, exc_traceback)))
+    else:
+        return EXCEPTION_OCCURRED

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/93932756/tools/marvin/marvin/cloudstackTestClient.py
----------------------------------------------------------------------
diff --git a/tools/marvin/marvin/cloudstackTestClient.py b/tools/marvin/marvin/cloudstackTestClient.py
index 4ac510b..f0ba135 100644
--- a/tools/marvin/marvin/cloudstackTestClient.py
+++ b/tools/marvin/marvin/cloudstackTestClient.py
@@ -15,201 +15,406 @@
 # specific language governing permissions and limitations
 # under the License.
 
-import cloudstackConnection
+from cloudstackConnection import CSConnection
 import asyncJobMgr
-import dbConnection
+from dbConnection import DbConnection
 from cloudstackAPI import *
 import random
 import string
 import hashlib
+from codes import (FAILED, PASS, ADMIN, DOMAIN_ADMIN,
+                   USER, SUCCESS, XEN_SERVER)
 from configGenerator import ConfigManager
-from marvin.integration.lib.utils import random_gen
+from marvin.integration.lib import utils
+from cloudstackException import GetDetailExceptionInfo
+from marvin.integration.lib.utils import (random_gen,
+                                          validateList)
+from marvin.cloudstackAPI.cloudstackAPIClient import CloudStackAPIClient
 
 '''
-@Desc  : CloudStackTestClient is encapsulated class for getting various \
-         clients viz., apiclient,dbconnection etc
+@Desc  : CloudStackTestClient is encapsulated entity for creating and
+         getting various clients viz., apiclient,
+         user api client, dbconnection, test Data parsed
+         information etc
 @Input : mgmtDetails : Management Server Details
          dbSvrDetails: Database Server details of Management \
                        Server. Retrieved from configuration file.
-         asyncTimeout :
-         defaultWorkerThreads :
-         logger : provides logging facilities for this library 
+         asyncTimeout : Timeout for Async queries
+         defaultWorkerThreads : Number of worker threads
+         logger : provides logging facilities for this library
+         zone : The zone on which test suites using this test client will run
 '''
 
 
-class cloudstackTestClient(object):
-    def __init__(self, mgmtDetails,
-                 dbSvrDetails, asyncTimeout=3600,
-                 defaultWorkerThreads=10,
-                 logger=None):
-        self.mgmtDetails = mgmtDetails
-        self.connection = \
-            cloudstackConnection.cloudConnection(self.mgmtDetails,
-                                                 asyncTimeout,
-                                                 logger)
-        self.apiClient =\
-            cloudstackAPIClient.CloudStackAPIClient(self.connection)
-        self.dbConnection = None
-        if dbSvrDetails is not None:
-                self.createDbConnection(dbSvrDetails.dbSvr, dbSvrDetails.port,
-                                        dbSvrDetails.user,
-                                        dbSvrDetails.passwd, dbSvrDetails.db)
-        '''
-        Provides the Configuration Object to users through getConfigParser
-        The purpose of this object is to parse the config
-        and provide dictionary of the config so users can
-        use that configuration.Users can later call getConfig
-        on this object and it will return the default parsed
-        config dictionary from default configuration file,
-        they can overwrite it with providing their own
-        configuration file as well.
-        '''
-        self.configObj = ConfigManager()
-        self.asyncJobMgr = None
-        self.id = None
-        self.defaultWorkerThreads = defaultWorkerThreads
+class CSTestClient(object):
+    def __init__(self, mgmt_details,
+                 dbsvr_details,
+                 async_timeout=3600,
+                 default_worker_threads=10,
+                 logger=None,
+                 test_data_filepath=None,
+                 zone=None):
+        self.__mgmtDetails = mgmt_details
+        self.__dbSvrDetails = dbsvr_details
+        self.__csConnection = None
+        self.__dbConnection = None
+        self.__testClient = None
+        self.__asyncTimeOut = async_timeout
+        self.__logger = logger
+        self.__defaultWorkerThreads = default_worker_threads
+        self.__apiClient = None
+        self.__userApiClient = None
+        self.__asyncJobMgr = None
+        self.__id = None
+        self.__testDataFilePath = test_data_filepath
+        self.__parsedTestDataConfig = None
+        self.__zone = zone
 
     @property
     def identifier(self):
-        return self.id
+        return self.__id
 
     @identifier.setter
     def identifier(self, id):
-        self.id = id
+        self.__id = id
 
-    def createDbConnection(self, host="localhost", port=3306, user='cloud',
-                           passwd='cloud', db='cloud'):
-        self.dbConnection = dbConnection.dbConnection(host, port, user,
-                                                      passwd, db)
+    def getParsedTestDataConfig(self):
+        '''
+        @Name : getParsedTestDataConfig
+        @Desc : Provides the TestData Config needed for
+                Tests are to Run
+        @Output : Returns the Parsed Test Data Dictionary
+        '''
+        return self.__parsedTestDataConfig
+
+    def getZoneForTests(self):
+        '''
+        @Name : getZoneForTests
+        @Desc : Provides the Zone against which Tests are to run
+                If zone name provided to marvin plugin is none
+                it will get it from Test Data Config File
+                Even, if  it is not available, return None
+        @Output : Returns the Zone Name
+        '''
+        if self.__zone is None:
+            if self.__parsedTestDataConfig is not None:
+                self.__zone = self.__parsedTestDataConfig.get("zone")
+        return self.__zone
+
+    def __setHypervisorToClient(self):
+        '''
+        @Name : ___setHypervisorToClient
+        @Desc:  Set the HyperVisor Details under API Client;
+                default to Xen
+        '''
+        if self.__mgmtDetails.hypervisor:
+            self.__apiClient.hypervisor = self.__mgmtDetails.hypervisor
+        else:
+            self.__apiClient.hypervisor = XEN_SERVER
+
+    def __createApiClient(self):
+        try:
+            '''
+            Step1 : Create a CS Connection Object
+            '''
+            self.__csConnection = CSConnection(self.__mgmtDetails,
+                                               self.__asyncTimeOut,
+                                               self.__logger)
+
+            '''
+            Step2 : Create API Client with earlier created connection object
+            '''
+            self.__apiClient = CloudStackAPIClient(self.__csConnection)
+
+            '''
+            Step3:  If API Key is not provided as part of Management Details,
+                    then verify and register
+            '''
+            if self.__mgmtDetails.apiKey is None:
+                list_user = listUsers.listUsersCmd()
+                list_user.account = "admin"
+                list_user_res = self.__apiClient.listUsers(list_user)
+                if list_user_res is None or\
+                        (validateList(list_user_res)[0] != PASS):
+                    self.__logger.debug("__createApiClient: API "
+                                        "Client Creation Failed")
+                    return FAILED
+
+                user_id = list_user_res[0].id
+                api_key = list_user_res[0].apikey
+                security_key = list_user_res[0].secretkey
+
+                if api_key is None:
+                    ret = self.__getKeys(user_id)
+                    if ret != FAILED:
+                        self.__mgmtDetails.port = 8080
+                        self.__mgmtDetails.apiKey = ret[0]
+                        self.__mgmtDetails.securityKey = ret[1]
+                    else:
+                        self.__logger.error("__createApiClient: API Client "
+                                            "Creation Failed while "
+                                            "Registering User")
+                        return FAILED
+                '''
+                Now Create the Connection objects and Api Client using
+                new details
+                '''
+                self.__csConnection = CSConnection(self.__mgmtDetails,
+                                                   self.__asyncTimeOut,
+                                                   self.__logger)
+                self.__apiClient = CloudStackAPIClient(self.__csConnection)
+            '''
+            Set the HyperVisor Details to Client default to Xen
+            '''
+            self.__setHypervisorToClient()
+            return SUCCESS
+        except Exception, e:
+            self.__logger.exception(" Exception Occurred Under "
+                                    "__createApiClient: %s" %
+                                    GetDetailExceptionInfo(e))
+            return FAILED
+
+    def __createDbConnection(self):
+        '''
+        @Name : ___createDbConnection
+        @Desc : Creates the CloudStack DB Connection
+        '''
+        host = "localhost" if self.__dbSvrDetails.dbSvr is None \
+            else self.__dbSvrDetails.dbSvr
+        port = 3306 if self.__dbSvrDetails.port is None \
+            else self.__dbSvrDetails.port
+        user = "cloud" if self.__dbSvrDetails.user is None \
+            else self.__dbSvrDetails.user
+        passwd = 'cloud' if self.__dbSvrDetails.passd is None \
+            else self.__dbSvrDetails.passd
+        db = 'cloud' if self.__dbSvrDetails.db is None \
+            else self.__dbSvrDetails.db
+        self.__dbConnection = DbConnection(host, port, user, passwd, db)
+
+    def __getKeys(self, userid):
+        '''
+        @Name : ___getKeys
+        @Desc : Retrieves the API and Secret Key for the provided Userid
+        '''
+        try:
+            register_user = registerUserKeys.registerUserKeysCmd()
+            register_user.id = userid
+            register_user_res = \
+                self.__apiClient.registerUserKeys(register_user)
+
+            if register_user_res == FAILED:
+                return FAILED
+            return (register_user_res.apikey, register_user_res.secretkey)
+        except Exception, e:
+            self.__logger.exception("Exception Occurred Under __geKeys : "
+                                    "%s" % GetDetailExceptionInfo(e))
+            return FAILED
+
+    def createTestClient(self):
+        '''
+        @Name : createTestClient
+        @Desc : Creates the Test Client.
+                The test Client is used by test suites
+                Here we create ParsedTestData Config.
+                Creates a DB Connection.
+                Creates an API Client
+        @Output : FAILED In case of an issue\Failure
+                  SUCCESS in case of Success of this function
+        '''
+        try:
+            '''
+            1. Create Config Object
+               Provides the Configuration Object to test suites through
+               getConfigParser. The purpose of this config object is to
+               parse the default config and provide dictionary of the
+               config so users can use that configuration.
+               Users can later call getConfig on this object and it will
+               return the default parsed config dictionary from default
+               configuration file. They can overwrite it with
+               providing their own configuration file as well.
+            '''
+            self.__configObj = ConfigManager(self.__testDataFilePath)
+            if self.__configObj is not None:
+                self.__parsedTestDataConfig = self.__configObj.getConfig()
+            else:
+                self.__logger.error("createTestClient : Not able to create "
+                                    "ConfigManager Object")
+                return FAILED
+            '''
+            2. Create DB Connection
+            '''
+            self.__createDbConnection()
+            '''
+            3. Creates API Client
+            '''
+            return self.__createApiClient()
+        except Exception, e:
+            self.__logger.exception("Exception Occurred "
+                                    "Under createTestClient "
+                                    ": %s" % GetDetailExceptionInfo(e))
+            return FAILED
 
     def isAdminContext(self):
         """
-        A user is a regular user if he fails to listDomains;
+        @Name : isAdminContext
+        @Desc:A user is a regular user if he fails to listDomains;
         if he is a domain-admin, he can list only domains that are non-ROOT;
         if he is an admin, he can list the ROOT domain successfully
         """
         try:
             listdom = listDomains.listDomainsCmd()
             listdom.name = 'ROOT'
-            listdomres = self.apiClient.listDomains(listdom)
-            rootdom = listdomres[0].name
-            if rootdom == 'ROOT':
-                return 1  # admin
-            else:
-                return 2  # domain-admin
+            listdomres = self.__apiClient.listDomains(listdom)
+            if listdomres != FAILED:
+                rootdom = listdomres[0].name
+                if rootdom == 'ROOT':
+                    return ADMIN
+                else:
+                    return DOMAIN_ADMIN
+            return USER
         except:
-            return 0  # user
-
-    def createUserApiClient(self, UserName, DomainName, acctType=0):
-        if not self.isAdminContext():
-            return self.apiClient
+            return USER
 
-        listDomain = listDomains.listDomainsCmd()
-        listDomain.listall = True
-        listDomain.name = DomainName
-        try:
-            domains = self.apiClient.listDomains(listDomain)
-            domId = domains[0].id
-        except:
-            cdomain = createDomain.createDomainCmd()
-            cdomain.name = DomainName
-            domain = self.apiClient.createDomain(cdomain)
-            domId = domain.id
-
-        cmd = listAccounts.listAccountsCmd()
-        cmd.name = UserName
-        cmd.domainid = domId
+    def __createUserApiClient(self, UserName, DomainName, acctType=0):
+        '''
+        @Name : ___createUserApiClient
+        @Desc : Creates a User API Client with given
+                UserName\DomainName Parameters
+        '''
         try:
-            accounts = self.apiClient.listAccounts(cmd)
-            acctId = accounts[0].id
-        except:
-            createAcctCmd = createAccount.createAccountCmd()
-            createAcctCmd.accounttype = acctType
-            createAcctCmd.domainid = domId
-            createAcctCmd.email = "test-" + random_gen()\
-                + "@cloudstack.org"
-            createAcctCmd.firstname = UserName
-            createAcctCmd.lastname = UserName
-            createAcctCmd.password = 'password'
-            createAcctCmd.username = UserName
-            acct = self.apiClient.createAccount(createAcctCmd)
-            acctId = acct.id
-
-        listuser = listUsers.listUsersCmd()
-        listuser.username = UserName
-
-        listuserRes = self.apiClient.listUsers(listuser)
-        userId = listuserRes[0].id
-        apiKey = listuserRes[0].apikey
-        securityKey = listuserRes[0].secretkey
-
-        if apiKey is None:
-            registerUser = registerUserKeys.registerUserKeysCmd()
-            registerUser.id = userId
-            registerUserRes = self.apiClient.registerUserKeys(registerUser)
-            apiKey = registerUserRes.apikey
-            securityKey = registerUserRes.secretkey
-
-        mgtDetails = self.mgmtDetails
-        mgtDetails.apiKey = apiKey
-        mgtDetails.securityKey = securityKey
-
-        newUserConnection =\
-            cloudstackConnection.cloudConnection(mgtDetails,
-                                                 self.connection.asyncTimeout,
-                                                 self.connection.logger)
-        self.userApiClient =\
-            cloudstackAPIClient.CloudStackAPIClient(newUserConnection)
-        self.userApiClient.connection = newUserConnection
-        self.userApiClient.hypervisor = self.apiClient.hypervisor
-        return self.userApiClient
+            if not self.isAdminContext():
+                return self.__apiClient
+
+            listDomain = listDomains.listDomainsCmd()
+            listDomain.listall = True
+            listDomain.name = DomainName
+            try:
+                domains = self.__apiClient.listDomains(listDomain)
+                domId = domains[0].id
+            except:
+                cdomain = createDomain.createDomainCmd()
+                cdomain.name = DomainName
+                domain = self.__apiClient.createDomain(cdomain)
+                domId = domain.id
+
+            cmd = listAccounts.listAccountsCmd()
+            cmd.name = UserName
+            cmd.domainid = domId
+            try:
+                accounts = self.__apiClient.listAccounts(cmd)
+                acctId = accounts[0].id
+            except:
+                createAcctCmd = createAccount.createAccountCmd()
+                createAcctCmd.accounttype = acctType
+                createAcctCmd.domainid = domId
+                createAcctCmd.email = "test-" + random_gen()\
+                    + "@cloudstack.org"
+                createAcctCmd.firstname = UserName
+                createAcctCmd.lastname = UserName
+                createAcctCmd.password = 'password'
+                createAcctCmd.username = UserName
+                acct = self.__apiClient.createAccount(createAcctCmd)
+                acctId = acct.id
+
+            listuser = listUsers.listUsersCmd()
+            listuser.username = UserName
+
+            listuserRes = self.__apiClient.listUsers(listuser)
+            userId = listuserRes[0].id
+            apiKey = listuserRes[0].apikey
+            securityKey = listuserRes[0].secretkey
+
+            if apiKey is None:
+                ret = self.__getKeys(userId)
+                if ret != FAILED:
+                    mgtDetails = self.__mgmtDetails
+                    mgtDetails.apiKey = ret[0]
+                    mgtDetails.securityKey = ret[1]
+                else:
+                    self.__logger.error("__createUserApiClient: "
+                                        "User API Client Creation."
+                                        " While Registering User Failed")
+                    return FAILED
+
+            newUserConnection =\
+                CSConnection(mgtDetails,
+                             self.__csConnection.asyncTimeout,
+                             self.__csConnection.logger)
+            self.__userApiClient = CloudStackAPIClient(newUserConnection)
+            self.__userApiClient.connection = newUserConnection
+            self.__userApiClient.hypervisor = self.__apiClient.hypervisor
+            return self.__userApiClient
+        except Exception, e:
+            self.__logger.exception("Exception Occurred "
+                                    "Under getUserApiClient : %s" %
+                                    GetDetailExceptionInfo(e))
+            return FAILED
 
     def close(self):
-        if self.connection is not None:
-            self.connection.close()
+        if self.__csConnection is not None:
+            self.__csConnection.close()
 
     def getDbConnection(self):
-        return self.dbConnection
+        '''
+        @Name : getDbConnection
+        @Desc : Retrieves the DB Connection Handle
+        '''
+        return self.__dbConnection
 
     def getConfigParser(self):
-        return self.configObj
+        '''
+        @Name : getConfigParser
+        @Desc : Provides the ConfigManager Interface to TestClients
+        '''
+        return self.__configObj
 
     def getApiClient(self):
-        self.apiClient.id = self.identifier
-        return self.apiClient
+        if self.__apiClient is not None:
+            self.__apiClient.id = self.identifier
+            return self.__apiClient
+        return None
 
     def getUserApiClient(self, account, domain, type=0):
         """
-        0 - user
-        1 - admin
-        2 - domain admin
+        @Name : getUserApiClient
+        @Desc : Provides the User API Client to Users
+        0 - user ; 1 - admin;2 - domain admin
+        @OutPut : FAILED In case of an issue
+                  else User API Client
         """
-        self.createUserApiClient(account, domain, type)
-        if hasattr(self, "userApiClient"):
-            return self.userApiClient
-        return None
+        return FAILED if (self.__createUserApiClient(account,
+                                                     domain,
+                                                     type)
+                          == FAILED) \
+            else self.__userApiClient
 
     def submitCmdsAndWait(self, cmds, workers=1):
-        '''FixME, httplib has issue if more than one thread submitted'''
-        if self.asyncJobMgr is None:
-            self.asyncJobMgr = asyncJobMgr.asyncJobMgr(self.apiClient,
-                                                       self.dbConnection)
-        return self.asyncJobMgr.submitCmdsAndWait(cmds, workers)
+        '''
+        @Desc : FixME, httplib has issue if more than one thread submitted
+        '''
+        if self.__asyncJobMgr is None:
+            self.__asyncJobMgr = asyncJobMgr.asyncJobMgr(self.__apiClient,
+                                                         self.__dbConnection)
+        return self.__asyncJobMgr.submitCmdsAndWait(cmds, workers)
 
     def submitJob(self, job, ntimes=1, nums_threads=10, interval=1):
         '''
-        submit one job and execute the same job ntimes, with nums_threads
-        of threads
+        @Desc : submit one job and execute the same job
+                ntimes, with nums_threads of threads
         '''
-        if self.asyncJobMgr is None:
-            self.asyncJobMgr = asyncJobMgr.asyncJobMgr(self.apiClient,
-                                                       self.dbConnection)
-        self.asyncJobMgr.submitJobExecuteNtimes(job, ntimes, nums_threads,
-                                                interval)
+        if self.__asyncJobMgr is None:
+            self.__asyncJobMgr = asyncJobMgr.asyncJobMgr(self.__apiClient,
+                                                         self.__dbConnection)
+        self.__asyncJobMgr.submitJobExecuteNtimes(job, ntimes,
+                                                  nums_threads,
+                                                  interval)
 
     def submitJobs(self, jobs, nums_threads=10, interval=1):
-        '''submit n jobs, execute them with nums_threads of threads'''
-        if self.asyncJobMgr is None:
-            self.asyncJobMgr = asyncJobMgr.asyncJobMgr(self.apiClient,
-                                                       self.dbConnection)
-        self.asyncJobMgr.submitJobs(jobs, nums_threads, interval)
+        '''
+        @Desc :submit n jobs, execute them with nums_threads
+               of threads
+        '''
+        if self.__asyncJobMgr is None:
+            self.__asyncJobMgr = asyncJobMgr.asyncJobMgr(self.__apiClient,
+                                                         self.__dbConnection)
+        self.__asyncJobMgr.submitJobs(jobs, nums_threads, interval)

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/93932756/tools/marvin/marvin/codegenerator.py
----------------------------------------------------------------------
diff --git a/tools/marvin/marvin/codegenerator.py b/tools/marvin/marvin/codegenerator.py
index e0f056f..d4a81cf 100644
--- a/tools/marvin/marvin/codegenerator.py
+++ b/tools/marvin/marvin/codegenerator.py
@@ -42,7 +42,7 @@ class cloudStackCmd(object):
         self.response = []
 
 
-class codeGenerator(object):
+class CodeGenerator(object):
     """
     Apache CloudStack- marvin python classes can be generated from the json
     returned by API discovery or from the xml spec of commands generated by
@@ -454,7 +454,7 @@ if __name__ == "__main__":
             print parser.print_help()
             exit(1)
 
-    cg = codeGenerator(folder)
+    cg = CodeGenerator(folder)
     if options.spec is not None:
         cg.generateCodeFromXML(apiSpecFile)
     elif options.endpoint is not None:

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/93932756/tools/marvin/marvin/codes.py
----------------------------------------------------------------------
diff --git a/tools/marvin/marvin/codes.py b/tools/marvin/marvin/codes.py
index 74fb05d..2f606dc 100644
--- a/tools/marvin/marvin/codes.py
+++ b/tools/marvin/marvin/codes.py
@@ -47,3 +47,18 @@ YES = "yes"
 FAILED = "FAILED"
 UNKNOWN_ERROR = "Unknown Error"
 EXCEPTION = "EXCEPTION"
+INVALID_RESPONSE = "Invalid Response"
+'''
+Async Job Related Codes
+'''
+JOB_INPROGRESS = 0
+JOB_SUCCEEDED = 1
+JOB_FAILED = 2
+JOB_CANCELLED = 3
+'''
+User Related Codes
+'''
+ADMIN = 1
+DOMAIN_ADMIN = 2
+USER = 0
+XEN_SERVER = "XenServer"

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/93932756/tools/marvin/marvin/config/__init__.py
----------------------------------------------------------------------
diff --git a/tools/marvin/marvin/config/__init__.py b/tools/marvin/marvin/config/__init__.py
new file mode 100644
index 0000000..e69de29


[4/4] git commit: updated refs/heads/marvin to 6a2cc9f

Posted by gi...@apache.org.
CLOUDSTACK-5925: Moved test data from testsuites to marvin/config

Also merged redundant testdata as they were found.


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

Branch: refs/heads/marvin
Commit: 6a2cc9fbd0e2943132d3c8b8f729d8470331dc20
Parents: 9393275
Author: Girish Shilamkar <gi...@clogeny.com>
Authored: Wed Jan 22 05:45:19 2014 +0530
Committer: Girish Shilamkar <gi...@clogeny.com>
Committed: Wed Jan 22 12:21:07 2014 +0530

----------------------------------------------------------------------
 test/integration/smoke/test_affinity_groups.py  |  42 +-
 test/integration/smoke/test_deploy_vm.py        |  37 +-
 .../smoke/test_deploy_vm_with_userdata.py       |  41 +-
 ...deploy_vms_with_varied_deploymentplanners.py |  40 +-
 test/integration/smoke/test_disk_offerings.py   |  31 +-
 test/integration/smoke/test_guest_vlan_range.py |  29 +-
 test/integration/smoke/test_hosts.py            |  68 +--
 test/integration/smoke/test_internal_lb.py      |  64 +--
 test/integration/smoke/test_iso.py              |  58 +-
 test/integration/smoke/test_loadbalance.py      |  82 +--
 .../smoke/test_multipleips_per_nic.py           |  36 +-
 test/integration/smoke/test_network.py          | 121 +----
 test/integration/smoke/test_network_acl.py      |  61 +--
 test/integration/smoke/test_nic.py              | 105 +---
 .../integration/smoke/test_portable_publicip.py |  74 +--
 test/integration/smoke/test_primary_storage.py  |  21 +-
 test/integration/smoke/test_public_ip_range.py  |  26 -
 test/integration/smoke/test_regions.py          |  19 +-
 .../smoke/test_reset_vm_on_reboot.py            |  60 +--
 test/integration/smoke/test_resource_detail.py  |  73 +--
 test/integration/smoke/test_routers.py          |  47 +-
 test/integration/smoke/test_scale_vm.py         |  69 +--
 .../integration/smoke/test_service_offerings.py | 104 +---
 test/integration/smoke/test_snapshots.py        | 108 +---
 test/integration/smoke/test_ssvm.py             |  10 -
 test/integration/smoke/test_templates.py        |  95 +---
 test/integration/smoke/test_vm_life_cycle.py    | 124 +----
 test/integration/smoke/test_vm_snapshots.py     |  72 +--
 test/integration/smoke/test_volumes.py          |  68 +--
 test/integration/smoke/test_vpc_vpn.py          |  95 +---
 tools/marvin/marvin/config/config.cfg           |  28 +-
 tools/marvin/marvin/config/test_data.cfg        | 540 ++++++++++++++-----
 32 files changed, 632 insertions(+), 1816 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/6a2cc9fb/test/integration/smoke/test_affinity_groups.py
----------------------------------------------------------------------
diff --git a/test/integration/smoke/test_affinity_groups.py b/test/integration/smoke/test_affinity_groups.py
index 0f8bdc4..346a4a4 100644
--- a/test/integration/smoke/test_affinity_groups.py
+++ b/test/integration/smoke/test_affinity_groups.py
@@ -24,44 +24,6 @@ from marvin.integration.lib.common import *
 from marvin.sshClient import SshClient
 from nose.plugins.attrib import attr
 
-class Services:
-    """Test Account Services
-    """
-
-    def __init__(self):
-        self.services = {
-            "domain": {
-                "name": "Domain",
-            },
-            "account": {
-                "email": "test@test.com",
-                "firstname": "Test",
-                "lastname": "User",
-                "username": "test",
-                # Random characters are appended for unique
-                # username
-                "password": "password",
-            },
-            "service_offering": {
-                "name": "Tiny Instance",
-                "displaytext": "Tiny Instance",
-                "cpunumber": 1,
-                "cpuspeed": 100,
-                # in MHz
-                "memory": 128,
-                # In MBs
-            },
-            "ostype": 'CentOS 5.3 (64-bit)',
-            "virtual_machine" : {
-                "affinity": {
-                    "name": "webvms",
-                    "type": "host anti-affinity",
-                },
-                "hypervisor" : "XenServer",
-            }
-        }
-
-
 class TestDeployVmWithAffinityGroup(cloudstackTestCase):
     """
     This test deploys a virtual machine into a user account
@@ -73,7 +35,7 @@ class TestDeployVmWithAffinityGroup(cloudstackTestCase):
         cls.test_client = super(TestDeployVmWithAffinityGroup, cls).getClsTestClient()
         zone_name = cls.test_client.getZoneForTests() 
         cls.api_client = cls.test_client.getApiClient()
-        cls.services = Services().services
+        cls.services = cls.test_client.getConfigParser().parsedDict
         # Get Zone, Domain and templates
         cls.domain = get_domain(cls.api_client, cls.services)
         cls.zone = get_zone(cls.api_client, cls.services)
@@ -97,7 +59,7 @@ class TestDeployVmWithAffinityGroup(cloudstackTestCase):
 
         cls.service_offering = ServiceOffering.create(
             cls.api_client,
-            cls.services["service_offering"]
+            cls.services["service_offerings"]
         )
 
         cls.ag = AffinityGroup.create(cls.api_client, cls.services["virtual_machine"]["affinity"],

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/6a2cc9fb/test/integration/smoke/test_deploy_vm.py
----------------------------------------------------------------------
diff --git a/test/integration/smoke/test_deploy_vm.py b/test/integration/smoke/test_deploy_vm.py
index 4104386..a09be35 100644
--- a/test/integration/smoke/test_deploy_vm.py
+++ b/test/integration/smoke/test_deploy_vm.py
@@ -33,46 +33,15 @@ from marvin.integration.lib.common import get_zone, get_domain, get_template
 
 from nose.plugins.attrib import attr
 
-class TestData(object):
-    """Test data object that is required to create resources
-    """
-    def __init__(self):
-        self.testdata = {
-            #data to create an account
-            "account": {
-                "email": "test@test.com",
-                "firstname": "Test",
-                "lastname": "User",
-                "username": "test",
-                "password": "password",
-            },
-            #data reqd for virtual machine creation
-            "virtual_machine" : {
-                "name" : "testvm",
-                "displayname" : "Test VM",
-            },
-            #small service offering
-            "service_offering": {
-                "small": {
-                    "name": "Small Instance",
-                    "displaytext": "Small Instance",
-                    "cpunumber": 1,
-                    "cpuspeed": 100,
-                    "memory": 256,
-                },
-            },
-            "ostype": 'CentOS 5.3 (64-bit)',
-        }
-
-
 class TestDeployVM(cloudstackTestCase):
     """Test deploy a VM into a user account
     """
 
     def setUp(self):
-        self.testdata = TestData().testdata
         self.apiclient = self.testClient.getApiClient()
 
+        self.testdata = self.testClient.getConfigParser().parsedDict
+        
         # Get Zone, Domain and Default Built-in template
         self.domain = get_domain(self.apiclient, self.testdata)
         self.zone = get_zone(self.apiclient, self.testdata)
@@ -88,7 +57,7 @@ class TestDeployVM(cloudstackTestCase):
         #create a service offering
         self.service_offering = ServiceOffering.create(
             self.apiclient,
-            self.testdata["service_offering"]["small"]
+            self.testdata["service_offerings"]["small"]
         )
         #build cleanup list
         self.cleanup = [

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/6a2cc9fb/test/integration/smoke/test_deploy_vm_with_userdata.py
----------------------------------------------------------------------
diff --git a/test/integration/smoke/test_deploy_vm_with_userdata.py b/test/integration/smoke/test_deploy_vm_with_userdata.py
index 85e768e..7bb72b3 100644
--- a/test/integration/smoke/test_deploy_vm_with_userdata.py
+++ b/test/integration/smoke/test_deploy_vm_with_userdata.py
@@ -26,52 +26,23 @@ from nose.plugins.attrib import attr
 import random
 import string
 
-class Services:
-    def __init__(self):
-        self.services = {
-            "account": {
-                "email": "test@test.com",
-                "firstname": "Test",
-                "lastname": "User",
-                "username": "test",
-                "password": "password",
-            },
-            "virtual_machine": {
-                "displayname": "Test VM",
-                "username": "root",
-                "password": "password",
-                "ssh_port": 22,
-                "hypervisor": 'XenServer',
-                "privateport": 22,
-                "publicport": 22,
-                "protocol": 'TCP',
-            },
-            "ostype": 'CentOS 5.3 (64-bit)',
-            "service_offering": {
-                "name": "Tiny Instance",
-                "displaytext": "Tiny Instance",
-                "cpunumber": 1,
-                "cpuspeed": 100,
-                "memory": 256,
-            },
-        }
-
-
 class TestDeployVmWithUserData(cloudstackTestCase):
     """Tests for UserData
     """
 
     @classmethod
     def setUpClass(cls):
-        cls.apiClient = super(TestDeployVmWithUserData, cls).getClsTestClient().getApiClient()
-        cls.services = Services().services
+        cloudstackTestClient = super(TestDeployVmWithUserData, cls).getClsTestClient()
+        cls.apiClient = cloudstackTestClient.getApiClient() 
+        cls.services = cloudstackTestClient.getConfigParser().parsedDict
+
         cls.zone = get_zone(cls.apiClient, cls.services)
         if cls.zone.localstorageenabled:
             #For devcloud since localstroage is enabled
-            cls.services["service_offering"]["storagetype"] = "local"
+            cls.services["service_offerings"]["storagetype"] = "local"
         cls.service_offering = ServiceOffering.create(
             cls.apiClient,
-            cls.services["service_offering"]
+            cls.services["service_offerings"]
         )
         cls.account = Account.create(cls.apiClient, services=cls.services["account"])
         cls.cleanup = [cls.account]

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/6a2cc9fb/test/integration/smoke/test_deploy_vms_with_varied_deploymentplanners.py
----------------------------------------------------------------------
diff --git a/test/integration/smoke/test_deploy_vms_with_varied_deploymentplanners.py b/test/integration/smoke/test_deploy_vms_with_varied_deploymentplanners.py
index b4d35e0..565228a 100644
--- a/test/integration/smoke/test_deploy_vms_with_varied_deploymentplanners.py
+++ b/test/integration/smoke/test_deploy_vms_with_varied_deploymentplanners.py
@@ -21,34 +21,6 @@ from marvin.integration.lib.common import get_zone, get_domain, get_template
 from marvin.integration.lib.utils import cleanup_resources
 from nose.plugins.attrib import attr
 
-class Services:
-    def __init__(self):
-        self.services = {
-            "account": {
-                "email": "test@test.com",
-                "firstname": "Test",
-                "lastname": "User",
-                "username": "test",
-                # Random characters are appended for unique
-                # username
-                "password": "password",
-            },
-            "service_offering": {
-                "name": "Planner Service Offering",
-                "displaytext": "Planner Service Offering",
-                "cpunumber": 1,
-                "cpuspeed": 100,
-                # in MHz
-                "memory": 128,
-                # In MBs
-            },
-            "ostype": 'CentOS 5.3 (64-bit)',
-            "virtual_machine": {
-                "hypervisor": "XenServer",
-            }
-        }
-
-
 class TestDeployVmWithVariedPlanners(cloudstackTestCase):
     """ Test to create services offerings for deployment planners
 	- firstfit, userdispersing
@@ -56,8 +28,10 @@ class TestDeployVmWithVariedPlanners(cloudstackTestCase):
 
     @classmethod
     def setUpClass(cls):
-        cls.apiclient = super(TestDeployVmWithVariedPlanners, cls).getClsTestClient().getApiClient()
-        cls.services = Services().services
+        cloudstackTestClient = super(TestDeployVmWithVariedPlanners, cls).getClsTestClient()
+        cls.apiclient = cloudstackTestClient.getApiClient()
+        cls.services = cloudstackTestClient.getConfigParser().parsedDict
+
         # Get Zone, Domain and templates
         cls.domain = get_domain(cls.apiclient, cls.services)
         cls.zone = get_zone(cls.apiclient, cls.services)
@@ -89,7 +63,7 @@ class TestDeployVmWithVariedPlanners(cloudstackTestCase):
         #FIXME: How do we know that first fit actually happened?
         self.service_offering_firstfit = ServiceOffering.create(
             self.apiclient,
-            self.services["service_offering"],
+            self.services["service_offerings"],
             deploymentplanner='FirstFitPlanner'
         )
 
@@ -132,7 +106,7 @@ class TestDeployVmWithVariedPlanners(cloudstackTestCase):
         """
         self.service_offering_userdispersing = ServiceOffering.create(
             self.apiclient,
-            self.services["service_offering"],
+            self.services["service_offerings"],
             deploymentplanner='UserDispersingPlanner'
         )
 
@@ -191,7 +165,7 @@ class TestDeployVmWithVariedPlanners(cloudstackTestCase):
         """
         self.service_offering_userconcentrated = ServiceOffering.create(
             self.apiclient,
-            self.services["service_offering"],
+            self.services["service_offerings"],
             deploymentplanner='UserConcentratedPodPlanner'
         )
 

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/6a2cc9fb/test/integration/smoke/test_disk_offerings.py
----------------------------------------------------------------------
diff --git a/test/integration/smoke/test_disk_offerings.py b/test/integration/smoke/test_disk_offerings.py
index 4588a26..b104ca8 100644
--- a/test/integration/smoke/test_disk_offerings.py
+++ b/test/integration/smoke/test_disk_offerings.py
@@ -27,23 +27,10 @@ from nose.plugins.attrib import attr
 
 _multiprocess_shared_ = True
 
-class Services:
-    """Test Disk offerings Services
-    """
-
-    def __init__(self):
-        self.services = {
-                         "off": {
-                                        "name": "Disk offering",
-                                        "displaytext": "Disk offering",
-                                        "disksize": 1   # in GB
-                                },
-                         }
-
 class TestCreateDiskOffering(cloudstackTestCase):
 
     def setUp(self):
-        self.services = Services().services
+        self.services = self.testClient.getConfigParser().parsedDict
         self.apiclient = self.testClient.getApiClient()
         self.dbclient = self.testClient.getDbConnection()
         self.cleanup = []
@@ -68,7 +55,7 @@ class TestCreateDiskOffering(cloudstackTestCase):
 
         disk_offering = DiskOffering.create(
                                         self.apiclient,
-                                        self.services["off"]
+                                        self.services["disk_offering"]
                                         )
         self.cleanup.append(disk_offering)
 
@@ -92,12 +79,12 @@ class TestCreateDiskOffering(cloudstackTestCase):
 
         self.assertEqual(
                             disk_response.displaytext,
-                            self.services["off"]["displaytext"],
+                            self.services["disk_offering"]["displaytext"],
                             "Check server id in createServiceOffering"
                         )
         self.assertEqual(
                             disk_response.name,
-                            self.services["off"]["name"],
+                            self.services["disk_offering"]["name"],
                             "Check name in createServiceOffering"
                         )
         return
@@ -122,15 +109,17 @@ class TestDiskOfferings(cloudstackTestCase):
 
     @classmethod
     def setUpClass(cls):
-        cls.services = Services().services
-        cls.api_client = super(TestDiskOfferings, cls).getClsTestClient().getApiClient()
+        cloudstackTestClient = super(TestDiskOfferings, cls).getClsTestClient()
+        self.api_client = self.cloudstackTestClient.getApiClient()
+        self.services = self.cloudstackTestClient.getConfigParser().parsedDict
+        
         cls.disk_offering_1 = DiskOffering.create(
                                                   cls.api_client,
-                                                  cls.services["off"]
+                                                  cls.services["disk_offering"]
                                                   )
         cls.disk_offering_2 = DiskOffering.create(
                                                   cls.api_client,
-                                                  cls.services["off"]
+                                                  cls.services["disk_offering"]
                                                   )
         cls._cleanup = [cls.disk_offering_1]
         return

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/6a2cc9fb/test/integration/smoke/test_guest_vlan_range.py
----------------------------------------------------------------------
diff --git a/test/integration/smoke/test_guest_vlan_range.py b/test/integration/smoke/test_guest_vlan_range.py
index 07e141d..4e2de50 100644
--- a/test/integration/smoke/test_guest_vlan_range.py
+++ b/test/integration/smoke/test_guest_vlan_range.py
@@ -26,35 +26,14 @@ from marvin.integration.lib.base import *
 from marvin.integration.lib.common import *
 import datetime
 
-
-class Services:
-    """Test Dedicating Guest Vlan Ranges
-    """
-
-    def __init__(self):
-        self.services = {
-                        "domain": {
-                                   "name": "Domain",
-                                   },
-                        "account": {
-                                    "email": "test@test.com",
-                                    "firstname": "Test",
-                                    "lastname": "User",
-                                    "username": "test",
-                                    "password": "password",
-                         },
-                        "name": "testphysicalnetwork",
-
-                        "vlan": "2118-2120",
-                    }
-
-
 class TestDedicateGuestVlanRange(cloudstackTestCase):
 
     @classmethod
     def setUpClass(cls):
-        cls.apiclient = super(TestDedicateGuestVlanRange, cls).getClsTestClient().getApiClient()
-        cls.services = Services().services
+        cloudstackTestClient = super(TestDedicateGuestVlanRange, cls).getClsTestClient()
+        cls.apiclient = cloudstackTestClient.getApiClient() 
+        cls.services = cloudstackTestClient.getConfigParser().parsedDict
+
         # Get Zone, Domain
         cls.domain = get_domain(cls.apiclient, cls.services)
         cls.zone = get_zone(cls.apiclient, cls.services)

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/6a2cc9fb/test/integration/smoke/test_hosts.py
----------------------------------------------------------------------
diff --git a/test/integration/smoke/test_hosts.py b/test/integration/smoke/test_hosts.py
index 6f7d400..4c58b9b 100644
--- a/test/integration/smoke/test_hosts.py
+++ b/test/integration/smoke/test_hosts.py
@@ -30,79 +30,13 @@ import time
 
 _multiprocess_shared_ = True
 
-class Services:
-    """Test Hosts & Clusters Services
-    """
-
-    def __init__(self):
-        self.services = {
-                       "clusters": {
-                                   0: {
-                                        "clustername": "Xen Cluster",
-                                        "clustertype": "CloudManaged",
-                                        # CloudManaged or ExternalManaged"
-                                        "hypervisor": "XenServer",
-                                        # Hypervisor type
-                                    },
-                                   1: {
-                                        "clustername": "KVM Cluster",
-                                        "clustertype": "CloudManaged",
-                                        # CloudManaged or ExternalManaged"
-                                        "hypervisor": "KVM",
-                                        # Hypervisor type
-                                        },
-                                   2: {
-                                        "hypervisor": 'VMware',
-                                        # Hypervisor type
-                                        "clustertype": 'ExternalManaged',
-                                        # CloudManaged or ExternalManaged"
-                                        "username": 'administrator',
-                                        "password": 'fr3sca',
-                                        "url": 'http://192.168.100.17/CloudStack-Clogeny-Pune/Pune-1',
-                                        # Format:http://vCenter Host/Datacenter/Cluster
-                                        "clustername": 'VMWare Cluster',
-                                        },
-                                    },
-                       "hosts": {
-                                 "xenserver": {
-                                # Must be name of corresponding Hypervisor type
-                                # in cluster in small letters
-                                          "hypervisor": 'XenServer',
-                                          # Hypervisor type
-                                          "clustertype": 'CloudManaged',
-                                          # CloudManaged or ExternalManaged"
-                                          "url": 'http://192.168.100.211',
-                                          "username": "root",
-                                          "password": "fr3sca",
-                                          },
-                                 "kvm": {
-                                          "hypervisor": 'KVM',
-                                          # Hypervisor type
-                                          "clustertype": 'CloudManaged',
-                                          # CloudManaged or ExternalManaged"
-                                          "url": 'http://192.168.100.212',
-                                          "username": "root",
-                                          "password": "fr3sca",
-                                          },
-                                 "vmware": {
-                                          "hypervisor": 'VMware',
-                                          # Hypervisor type
-                                          "clustertype": 'ExternalManaged',
-                                          # CloudManaged or ExternalManaged"
-                                          "url": 'http://192.168.100.203',
-                                          "username": "administrator",
-                                          "password": "fr3sca",
-                                         },
-                                 },
-                       }
-
 class TestHosts(cloudstackTestCase):
 
     def setUp(self):
 
         self.apiclient = self.testClient.getApiClient()
         self.dbclient = self.testClient.getDbConnection()
-        self.services = Services().services
+        self.services = self.testClient.getConfigParser().parsedDict
         self.zone = get_zone(self.apiclient, self.services)
         self.pod = get_pod(self.apiclient, self.zone.id, self.services)
         self.cleanup = []

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/6a2cc9fb/test/integration/smoke/test_internal_lb.py
----------------------------------------------------------------------
diff --git a/test/integration/smoke/test_internal_lb.py b/test/integration/smoke/test_internal_lb.py
index 7510169..d997ae0 100644
--- a/test/integration/smoke/test_internal_lb.py
+++ b/test/integration/smoke/test_internal_lb.py
@@ -24,73 +24,21 @@ from marvin.integration.lib.base import *
 from marvin.integration.lib.common import *
 from nose.plugins.attrib import attr
 
-
-class Services:
-    def __init__(self):
-        self.services = {
-            "account": {
-                "email": "test@test.com",
-                "firstname": "Test",
-                "lastname": "User",
-                "username": "test",
-                "password": "password",
-            },
-            "virtual_machine": {
-                "displayname": "Test VM",
-                "username": "root",
-                "password": "password",
-                "ssh_port": 22,
-                "hypervisor": 'XenServer',
-                "privateport": 22,
-                "publicport": 22,
-                "protocol": 'TCP',
-            },
-            "ostype": 'CentOS 5.3 (64-bit)',
-            "service_offering": {
-                "name": "Tiny Instance",
-                "displaytext": "Tiny Instance",
-                "cpunumber": 1,
-                "cpuspeed": 100,
-                "memory": 256,
-            },
-            "network_offering": {
-                "name": "Network offering for internal lb service",
-                "displaytext": "Network offering for internal lb service",
-                "guestiptype": "Isolated",
-                "traffictype": "Guest",
-                "supportedservices": "Vpn,Dhcp,Dns,Lb,UserData,SourceNat,StaticNat,PortForwarding,NetworkACL",
-                "serviceProviderList": {
-                    "Dhcp": "VpcVirtualRouter",
-                    "Dns": "VpcVirtualRouter",
-                    "Vpn": "VpcVirtualRouter",
-                    "UserData": "VpcVirtualRouter",
-                    "Lb": "InternalLbVM",
-                    "SourceNat": "VpcVirtualRouter",
-                    "StaticNat": "VpcVirtualRouter",
-                    "PortForwarding": "VpcVirtualRouter",
-                    "NetworkACL": "VpcVirtualRouter",
-                },
-                "serviceCapabilityList": {
-                    "SourceNat": {"SupportedSourceNatTypes": "peraccount"},
-                    "Lb": {"lbSchemes": "internal", "SupportedLbIsolation": "dedicated"}
-                }
-            }
-        }
-
-
 class TestInternalLb(cloudstackTestCase):
     """Test Internal LB
     """
 
     @classmethod
     def setUpClass(cls):
-        cls.apiclient = super(TestInternalLb, cls).getClsTestClient().getApiClient()
-        cls.services = Services().services
+        cloudstackTestClient = super(TestInternalLb, cls).getClsTestClient()
+        cls.apiclient = cloudstackTestClient.getApiClient()
+        cls.services = cloudstackTestClient.getConfigParser().parsedDict
+
         cls.zone = get_zone(cls.apiclient, cls.services)
         cls.domain = get_domain(cls.apiclient)
         cls.service_offering = ServiceOffering.create(
             cls.apiclient,
-            cls.services["service_offering"]
+            cls.services["service_offerings"]
         )
         cls.account = Account.create(cls.apiclient, services=cls.services["account"])
         cls.template = get_template(
@@ -109,7 +57,7 @@ class TestInternalLb(cloudstackTestCase):
         """
 
         #1) Create and enable network offering with Internal Lb vm service
-        self.networkOffering = NetworkOffering.create(self.apiclient, self.services["network_offering"], conservemode=False)
+        self.networkOffering = NetworkOffering.create(self.apiclient, self.services["network_offering_internal_lb"], conservemode=False)
         self.networkOffering.update(self.apiclient, state="Enabled")
 
         #2) Create VPC and network in it

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/6a2cc9fb/test/integration/smoke/test_iso.py
----------------------------------------------------------------------
diff --git a/test/integration/smoke/test_iso.py b/test/integration/smoke/test_iso.py
index 75289b8..50042ba 100644
--- a/test/integration/smoke/test_iso.py
+++ b/test/integration/smoke/test_iso.py
@@ -31,61 +31,10 @@ import time
 
 _multiprocess_shared_ = True
 
-class Services:
-    """Test ISO Services
-    """
-
-    def __init__(self):
-        self.services = {
-            "account": {
-                        "email": "test@test.com",
-                        "firstname": "Test",
-                        "lastname": "User",
-                        "username": "test",
-                        # Random characters are appended in create account to 
-                        # ensure unique username generated each time
-                        "password": "password",
-                },
-            "iso_1":
-                    {
-                        "displaytext": "Test ISO 1",
-                        "name": "ISO 1",
-                        "url": "http://people.apache.org/~tsp/dummy.iso",
-                        # Source URL where ISO is located
-                        "isextractable": True,
-                        "isfeatured": True,
-                        "ispublic": True,
-                        "ostype": "CentOS 5.3 (64-bit)",
-                    },
-            "iso_2":
-                    {
-                        "displaytext": "Test ISO 2",
-                        "name": "ISO 2",
-                        "url": "http://people.apache.org/~tsp/dummy.iso",
-                        # Source URL where ISO is located
-                        "isextractable": True,
-                        "isfeatured": True,
-                        "ispublic": True,
-                        "ostype": "CentOS 5.3 (64-bit)",
-                        "mode": 'HTTP_DOWNLOAD',
-                        # Used in Extract template, value must be HTTP_DOWNLOAD
-                    },
-            "isfeatured": True,
-            "ispublic": True,
-            "isextractable": True,
-            "bootable": True, # For edit template
-            "passwordenabled": True,
-            "sleep": 60,
-            "timeout": 10,
-            "ostype": "CentOS 5.3 (64-bit)",
-            # CentOS 5.3 (64 bit)
-        }
-
-
 class TestCreateIso(cloudstackTestCase):
 
     def setUp(self):
-        self.services = Services().services
+        self.services = self.testClient.getConfigParser().parsedDict
         self.apiclient = self.testClient.getApiClient()
         self.dbclient = self.testClient.getDbConnection()
         # Get Zone, Domain and templates
@@ -189,8 +138,9 @@ class TestISO(cloudstackTestCase):
 
     @classmethod
     def setUpClass(cls):
-        cls.services = Services().services
-        cls.api_client = super(TestISO, cls).getClsTestClient().getApiClient()
+        cloudstackTestClient = super(TestISO, cls).getClsTestClient()
+        cls.api_client = cloudstackTestClient.getApiClient()
+        cls.services = cloudstackTestClient.getConfigParser().parsedDict
 
         # Get Zone, Domain and templates
         cls.domain = get_domain(cls.api_client, cls.services)

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/6a2cc9fb/test/integration/smoke/test_loadbalance.py
----------------------------------------------------------------------
diff --git a/test/integration/smoke/test_loadbalance.py b/test/integration/smoke/test_loadbalance.py
index 5f80c38..db8f46e 100644
--- a/test/integration/smoke/test_loadbalance.py
+++ b/test/integration/smoke/test_loadbalance.py
@@ -27,87 +27,15 @@ import time
 
 _multiprocess_shared_ = True
 
-class Services:
-    """Test Network Services
-    """
-
-    def __init__(self):
-        self.services = {
-                            "ostype": "CentOS 5.3 (64-bit)",
-                            # Cent OS 5.3 (64 bit)
-                            "lb_switch_wait": 10,
-                            # Time interval after which LB switches the requests
-                            "sleep": 60,
-                            "timeout":10,
-                            "network_offering": {
-                                    "name": 'Test Network offering',
-                                    "displaytext": 'Test Network offering',
-                                    "guestiptype": 'Isolated',
-                                    "supportedservices": 'Dhcp,Dns,SourceNat,PortForwarding',
-                                    "traffictype": 'GUEST',
-                                    "availability": 'Optional',
-                                    "serviceProviderList" : {
-                                            "Dhcp": 'VirtualRouter',
-                                            "Dns": 'VirtualRouter',
-                                            "SourceNat": 'VirtualRouter',
-                                            "PortForwarding": 'VirtualRouter',
-                                        },
-                                },
-                            "network": {
-                                  "name": "Test Network",
-                                  "displaytext": "Test Network",
-                                },
-                            "service_offering": {
-                                    "name": "Tiny Instance",
-                                    "displaytext": "Tiny Instance",
-                                    "cpunumber": 1,
-                                    "cpuspeed": 100,
-                                    # in MHz
-                                    "memory": 256,
-                                    # In MBs
-                                    },
-                            "account": {
-                                    "email": "test@test.com",
-                                    "firstname": "Test",
-                                    "lastname": "User",
-                                    "username": "test",
-                                    "password": "password",
-                                    },
-                            "server":
-                                    {
-                                    "displayname": "Small Instance",
-                                    "username": "root",
-                                    "password": "password",
-                                    "hypervisor": 'XenServer',
-                                    "privateport": 22,
-                                    "publicport": 22,
-                                    "ssh_port": 22,
-                                    "protocol": 'TCP',
-                                },
-                        "natrule":
-                                {
-                                    "privateport": 22,
-                                    "publicport": 2222,
-                                    "protocol": "TCP"
-                                },
-                        "lbrule":
-                                {
-                                    "name": "SSH",
-                                    "alg": "roundrobin",
-                                    # Algorithm used for load balancing
-                                    "privateport": 22,
-                                    "publicport": 2222,
-                                    "protocol": 'TCP'
-                                }
-                        }
-
 class TestLoadBalance(cloudstackTestCase):
 
     @classmethod
     def setUpClass(cls):
 
-        cls.api_client = super(TestLoadBalance, cls).getClsTestClient().getApiClient()
-        cls.services = Services().services
+        cloudstackTestClient = super(TestLoadBalance, cls).getClsTestClient()
+        cls.api_client = cloudstackTestClient.getApiClient() 
+        cls.services = cloudstackTestClient.getConfigParser().parsedDict
+
         # Get Zone, Domain and templates
         cls.domain = get_domain(cls.api_client, cls.services)
         cls.zone = get_zone(cls.api_client, cls.services)
@@ -127,7 +55,7 @@ class TestLoadBalance(cloudstackTestCase):
                             )
         cls.service_offering = ServiceOffering.create(
                                         cls.api_client,
-                                        cls.services["service_offering"]
+                                        cls.services["service_offerings"]
                                         )
         cls.vm_1 = VirtualMachine.create(
                                     cls.api_client,

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/6a2cc9fb/test/integration/smoke/test_multipleips_per_nic.py
----------------------------------------------------------------------
diff --git a/test/integration/smoke/test_multipleips_per_nic.py b/test/integration/smoke/test_multipleips_per_nic.py
index 7d18064..9e04b53 100644
--- a/test/integration/smoke/test_multipleips_per_nic.py
+++ b/test/integration/smoke/test_multipleips_per_nic.py
@@ -38,44 +38,12 @@ from marvin.cloudstackAPI.listNics import listNicsCmd
 
 from nose.plugins.attrib import attr
 
-class TestData(object):
-    """Test data object that is required to create resources
-    """
-    def __init__(self):
-        self.testdata = {
-            #data to create an account
-            "account": {
-                "email": "test@test.com",
-                "firstname": "Test",
-                "lastname": "User",
-                "username": "test",
-                "password": "password",
-            },
-            #data reqd for virtual machine creation
-            "virtual_machine" : {
-                "name" : "testvm",
-                "displayname" : "Test VM",
-            },
-            #small service offering
-            "service_offering": {
-                "small": {
-                    "name": "Small Instance",
-                    "displaytext": "Small Instance",
-                    "cpunumber": 1,
-                    "cpuspeed": 100,
-                    "memory": 256,
-                },
-            },
-            "ostype": 'CentOS 5.3 (64-bit)',
-        }
-
-
 class TestDeployVM(cloudstackTestCase):
     """Test deploy a VM into a user account
     """
 
     def setUp(self):
-        self.testdata = TestData().testdata
+        self.testdata = self.testClient.getConfigParser().parsedDict
         self.apiclient = self.testClient.getApiClient()
 
         # Get Zone, Domain and Default Built-in template
@@ -93,7 +61,7 @@ class TestDeployVM(cloudstackTestCase):
         #create a service offering
         self.service_offering = ServiceOffering.create(
             self.apiclient,
-            self.testdata["service_offering"]["small"]
+            self.testdata["service_offerings"]["small"]
         )
         #build cleanup list
         self.cleanup = [

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/6a2cc9fb/test/integration/smoke/test_network.py
----------------------------------------------------------------------
diff --git a/test/integration/smoke/test_network.py b/test/integration/smoke/test_network.py
index 732fe15..f0cdcfd 100644
--- a/test/integration/smoke/test_network.py
+++ b/test/integration/smoke/test_network.py
@@ -31,80 +31,6 @@ import time
 
 _multiprocess_shared_ = True
 
-class Services:
-    """Test Network Services
-    """
-
-    def __init__(self):
-        self.services = {
-                            "ostype": "CentOS 5.3 (64-bit)",
-                            # Cent OS 5.3 (64 bit)
-                            "lb_switch_wait": 10,
-                            # Time interval after which LB switches the requests
-                            "sleep": 60,
-                            "timeout":10,
-                            "network_offering": {
-                                    "name": 'Test Network offering',
-                                    "displaytext": 'Test Network offering',
-                                    "guestiptype": 'Isolated',
-                                    "supportedservices": 'Dhcp,Dns,SourceNat,PortForwarding',
-                                    "traffictype": 'GUEST',
-                                    "availability": 'Optional',
-                                    "serviceProviderList" : {
-                                            "Dhcp": 'VirtualRouter',
-                                            "Dns": 'VirtualRouter',
-                                            "SourceNat": 'VirtualRouter',
-                                            "PortForwarding": 'VirtualRouter',
-                                        },
-                                },
-                            "network": {
-                                  "name": "Test Network",
-                                  "displaytext": "Test Network",
-                                },
-                            "service_offering": {
-                                    "name": "Tiny Instance",
-                                    "displaytext": "Tiny Instance",
-                                    "cpunumber": 1,
-                                    "cpuspeed": 100,
-                                    # in MHz
-                                    "memory": 256,
-                                    # In MBs
-                                    },
-                            "account": {
-                                    "email": "test@test.com",
-                                    "firstname": "Test",
-                                    "lastname": "User",
-                                    "username": "test",
-                                    "password": "password",
-                                    },
-                            "server":
-                                    {
-                                    "displayname": "Small Instance",
-                                    "username": "root",
-                                    "password": "password",
-                                    "hypervisor": 'XenServer',
-                                    "privateport": 22,
-                                    "publicport": 22,
-                                    "ssh_port": 22,
-                                    "protocol": 'TCP',
-                                },
-                        "natrule":
-                                {
-                                    "privateport": 22,
-                                    "publicport": 22,
-                                    "protocol": "TCP"
-                                },
-                        "lbrule":
-                                {
-                                    "name": "SSH",
-                                    "alg": "roundrobin",
-                                    # Algorithm used for load balancing
-                                    "privateport": 22,
-                                    "publicport": 2222,
-                                    "protocol": 'TCP'
-                                }
-                        }
-
 
 class TestPublicIP(cloudstackTestCase):
 
@@ -114,8 +40,10 @@ class TestPublicIP(cloudstackTestCase):
 
     @classmethod
     def setUpClass(cls):
-        cls.api_client = super(TestPublicIP, cls).getClsTestClient().getApiClient()
-        cls.services = Services().services
+        cloudstackTestClient = super(TestPublicIP, cls).getClsTestClient()
+        cls.api_client = cloudstackTestClient.getApiClient()
+        cls.services = cloudstackTestClient.getConfigParser().parsedDict
+
         # Get Zone, Domain and templates
         cls.domain = get_domain(cls.api_client, cls.services)
         cls.zone = get_zone(cls.api_client, cls.services)
@@ -293,9 +221,10 @@ class TestPortForwarding(cloudstackTestCase):
     @classmethod
     def setUpClass(cls):
 
-        cls.api_client = super(TestPortForwarding, cls).getClsTestClient().getApiClient()
-        cls.services = Services().services
-
+        cloudstackTestClient = super(TestPortForwarding, cls).getClsTestClient()
+        cls.api_client = cloudstackTestClient.getApiClient()
+        cls.services = cloudstackTestClient.getConfigParser().parsedDict
+        
         # Get Zone, Domain and templates
         cls.domain = get_domain(cls.api_client, cls.services)
         cls.zone = get_zone(cls.api_client, cls.services)
@@ -311,14 +240,14 @@ class TestPortForwarding(cloudstackTestCase):
                                 admin=True,
                                 domainid=cls.domain.id
                                 )
-        cls.services["server"]["zoneid"] = cls.zone.id
+        cls.services["virtual_machine"]["zoneid"] = cls.zone.id
         cls.service_offering = ServiceOffering.create(
                                 cls.api_client,
-                                cls.services["service_offering"]
+                                cls.services["service_offerings"]
                                 )
         cls.virtual_machine = VirtualMachine.create(
                                     cls.api_client,
-                                    cls.services["server"],
+                                    cls.services["virtual_machine"],
                                     templateid=template.id,
                                     accountid=cls.account.name,
                                     domainid=cls.account.domainid,
@@ -483,7 +412,7 @@ class TestPortForwarding(cloudstackTestCase):
                                             self.account.name,
                                             self.zone.id,
                                             self.account.domainid,
-                                            self.services["server"]
+                                            self.services["virtual_machine"]
                                             )
         self.cleanup.append(ip_address)
 
@@ -596,7 +525,7 @@ class TestRebootRouter(cloudstackTestCase):
     def setUp(self):
 
         self.apiclient = self.testClient.getApiClient()
-        self.services = Services().services
+        self.services = self.testClient.cloudstackTestClient.getConfigParser().parsedDict
 
         # Get Zone, Domain and templates
         self.domain = get_domain(self.apiclient, self.services)
@@ -606,7 +535,7 @@ class TestRebootRouter(cloudstackTestCase):
                             self.zone.id,
                             self.services["ostype"]
                             )
-        self.services["server"]["zoneid"] = self.zone.id
+        self.services["virtual_machine"]["zoneid"] = self.zone.id
 
         #Create an account, network, VM and IP addresses
         self.account = Account.create(
@@ -617,11 +546,11 @@ class TestRebootRouter(cloudstackTestCase):
                                       )
         self.service_offering = ServiceOffering.create(
                                             self.apiclient,
-                                            self.services["service_offering"]
+                                            self.services["service_offerings"]
                                             )
         self.vm_1 = VirtualMachine.create(
                                     self.apiclient,
-                                    self.services["server"],
+                                    self.services["virtual_machine"],
                                     templateid=template.id,
                                     accountid=self.account.name,
                                     domainid=self.account.domainid,
@@ -646,7 +575,7 @@ class TestRebootRouter(cloudstackTestCase):
                                             self.vm_1.account,
                                             self.vm_1.zoneid,
                                             self.vm_1.domainid,
-                                            self.services["server"]
+                                            self.services["virtual_machine"]
                                             )
         #Open up firewall port for SSH
         fw_rule = FireWallRule.create(
@@ -762,7 +691,7 @@ class TestReleaseIP(cloudstackTestCase):
 
     def setUp(self):
         self.apiclient = self.testClient.getApiClient()
-        self.services = Services().services
+        self.services = self.testClient.getConfigParser().parsedDict
 
         # Get Zone, Domain and templates
         self.domain = get_domain(self.apiclient, self.services)
@@ -772,7 +701,7 @@ class TestReleaseIP(cloudstackTestCase):
                             self.zone.id,
                             self.services["ostype"]
                             )
-        self.services["server"]["zoneid"] = self.zone.id
+        self.services["virtual_machine"]["zoneid"] = self.zone.id
 
         #Create an account, network, VM, Port forwarding rule, LB rules
         self.account = Account.create(
@@ -784,12 +713,12 @@ class TestReleaseIP(cloudstackTestCase):
 
         self.service_offering = ServiceOffering.create(
                                            self.apiclient,
-                                           self.services["service_offering"]
+                                           self.services["service_offerings"]
                                          )
 
         self.virtual_machine = VirtualMachine.create(
                                     self.apiclient,
-                                    self.services["server"],
+                                    self.services["virtual_machine"],
                                     templateid=template.id,
                                     accountid=self.account.name,
                                     domainid=self.account.domainid,
@@ -899,7 +828,7 @@ class TestDeleteAccount(cloudstackTestCase):
     def setUp(self):
 
         self.apiclient = self.testClient.getApiClient()
-        self.services = Services().services
+        self.services = self.testClient.getConfigParser().parsedDict
 
         # Get Zone, Domain and templates
         self.domain = get_domain(self.apiclient, self.services)
@@ -909,7 +838,7 @@ class TestDeleteAccount(cloudstackTestCase):
                             self.zone.id,
                             self.services["ostype"]
                             )
-        self.services["server"]["zoneid"] = self.zone.id
+        self.services["virtual_machine"]["zoneid"] = self.zone.id
 
         #Create an account, network, VM and IP addresses
         self.account = Account.create(
@@ -920,11 +849,11 @@ class TestDeleteAccount(cloudstackTestCase):
                                 )
         self.service_offering = ServiceOffering.create(
                                     self.apiclient,
-                                    self.services["service_offering"]
+                                    self.services["service_offerings"]
                                     )
         self.vm_1 = VirtualMachine.create(
                                     self.apiclient,
-                                    self.services["server"],
+                                    self.services["virtual_machine"],
                                     templateid=template.id,
                                     accountid=self.account.name,
                                     domainid=self.account.domainid,

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/6a2cc9fb/test/integration/smoke/test_network_acl.py
----------------------------------------------------------------------
diff --git a/test/integration/smoke/test_network_acl.py b/test/integration/smoke/test_network_acl.py
index 3363e46..9e8df15 100644
--- a/test/integration/smoke/test_network_acl.py
+++ b/test/integration/smoke/test_network_acl.py
@@ -24,70 +24,19 @@ from marvin.integration.lib.base import *
 from marvin.integration.lib.common import *
 from nose.plugins.attrib import attr
 
-class Services:
-    def __init__(self):
-        self.services = {
-            "account": {
-                "email": "test@test.com",
-                "firstname": "Test",
-                "lastname": "User",
-                "username": "test",
-                "password": "password",
-            },
-            "virtual_machine": {
-                "displayname": "Test VM",
-                "username": "root",
-                "password": "password",
-                "ssh_port": 22,
-                "hypervisor": 'XenServer',
-                "privateport": 22,
-                "publicport": 22,
-                "protocol": 'TCP',
-            },
-            "ostype": 'CentOS 5.3 (64-bit)',
-            "service_offering": {
-                "name": "Tiny Instance",
-                "displaytext": "Tiny Instance",
-                "cpunumber": 1,
-                "cpuspeed": 100,
-                "memory": 256,
-            },
-            "network_offering": {
-                "name": "Network offering for internal lb service",
-                "displaytext": "Network offering for internal lb service",
-                "guestiptype": "Isolated",
-                "traffictype": "Guest",
-                "supportedservices": "Vpn,Dhcp,Dns,Lb,UserData,SourceNat,StaticNat,PortForwarding,NetworkACL",
-                "serviceProviderList": {
-                    "Dhcp": "VpcVirtualRouter",
-                    "Dns": "VpcVirtualRouter",
-                    "Vpn": "VpcVirtualRouter",
-                    "UserData": "VpcVirtualRouter",
-                    "Lb": "InternalLbVM",
-                    "SourceNat": "VpcVirtualRouter",
-                    "StaticNat": "VpcVirtualRouter",
-                    "PortForwarding": "VpcVirtualRouter",
-                    "NetworkACL": "VpcVirtualRouter",
-                },
-                "serviceCapabilityList": {
-                    "SourceNat": {"SupportedSourceNatTypes": "peraccount"},
-                    "Lb": {"lbSchemes": "internal", "SupportedLbIsolation": "dedicated"}
-                }
-            }
-        }
-
-
 class TestNetworkACL(cloudstackTestCase):
 
     @classmethod
     def setUpClass(cls):
-        cls.apiclient = super(TestNetworkACL, cls).getClsTestClient().getApiClient()
-        cls.services = Services().services
+        cloudstackTestClient = super(TestNetworkACL, cls).getClsTestClient()
+        cls.api_client = cloudstackTestClient.getApiClient()
+        cls.services = cloudstackTestClient.getConfigParser().parsedDict
+
         cls.zone = get_zone(cls.apiclient, cls.services)
         cls.domain = get_domain(cls.apiclient)
         cls.service_offering = ServiceOffering.create(
             cls.apiclient,
-            cls.services["service_offering"]
+            cls.services["service_offerings"]
         )
         cls.account = Account.create(cls.apiclient, services=cls.services["account"])
         cls.template = get_template(

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/6a2cc9fb/test/integration/smoke/test_nic.py
----------------------------------------------------------------------
diff --git a/test/integration/smoke/test_nic.py b/test/integration/smoke/test_nic.py
index ac95685..0f87de1 100644
--- a/test/integration/smoke/test_nic.py
+++ b/test/integration/smoke/test_nic.py
@@ -28,107 +28,6 @@ import signal
 import sys
 import time
 
-class Services:
-    def __init__(self):
-        self.services = {
-            "disk_offering":{
-                "displaytext": "Small",
-                "name": "Small",
-                "disksize": 1
-            },
-            "account": {
-                "email": "test@test.com",
-                "firstname": "Test",
-                "lastname": "User",
-                "username": "test",
-                # Random characters are appended in create account to
-                # ensure unique username generated each time
-                "password": "password",
-            },
-            # Create a small virtual machine instance with disk offering
-            "small": {
-                "displayname": "testserver",
-                "username": "root", # VM creds for SSH
-                "password": "password",
-                "ssh_port": 22,
-                "hypervisor": 'XenServer',
-                "privateport": 22,
-                "publicport": 22,
-                "protocol": 'TCP',
-            },
-            "service_offerings": {
-                "tiny": {
-                    "name": "Tiny Instance",
-                    "displaytext": "Tiny Instance",
-                    "cpunumber": 1,
-                    "cpuspeed": 100, # in MHz
-                    "memory": 128, # In MBs
-                },
-            },
-            "network_offering": {
-                "name": 'Test Network offering',
-                "displaytext": 'Test Network offering',
-                "guestiptype": 'Isolated',
-                "supportedservices": 'Dhcp,Dns,SourceNat,PortForwarding',
-                "traffictype": 'GUEST',
-                "availability": 'Optional',
-                "serviceProviderList" : {
-                    "Dhcp": 'VirtualRouter',
-                    "Dns": 'VirtualRouter',
-                    "SourceNat": 'VirtualRouter',
-                    "PortForwarding": 'VirtualRouter',
-                },
-            },
-            "network_offering_shared": {
-                "name": 'Test Network offering shared',
-                "displaytext": 'Test Network offering Shared',
-                "guestiptype": 'Shared',
-                "supportedservices": 'Dhcp,Dns,UserData',
-                "traffictype": 'GUEST',
-                "specifyVlan" : "True",
-                "specifyIpRanges" : "True",
-                "serviceProviderList" : {
-                    "Dhcp": 'VirtualRouter',
-                    "Dns": 'VirtualRouter',
-                    "UserData": 'VirtualRouter',
-                },
-            },
-            "network": {
-                "name": "Test Network",
-                "displaytext": "Test Network",
-                "acltype": "Account",
-            },
-            "network2": {
-                "name": "Test Network Shared",
-                "displaytext": "Test Network Shared",
-                "vlan" :1201,
-                "gateway" :"172.16.15.1",
-                "netmask" :"255.255.255.0",
-                "startip" :"172.16.15.21",
-                "endip" :"172.16.15.41",
-                "acltype": "Account",
-            },
-            # ISO settings for Attach/Detach ISO tests
-            "iso": {
-                "displaytext": "Test ISO",
-                "name": "testISO",
-                "url": "http://people.apache.org/~tsp/dummy.iso",
-                 # Source URL where ISO is located
-                "ostype": 'CentOS 5.3 (64-bit)',
-                "mode": 'HTTP_DOWNLOAD', # Downloading existing ISO 
-            },
-            "template": {
-                "displaytext": "Cent OS Template",
-                "name": "Cent OS Template",
-                "passwordenabled": True,
-            },
-            "sleep": 60,
-            "timeout": 10,
-            #Migrate VM to hostid
-            "ostype": 'CentOS 5.3 (64-bit)',
-            # CentOS 5.3 (64-bit)
-        }
-
 class TestNic(cloudstackTestCase):
 
     def setUp(self):
@@ -145,7 +44,7 @@ class TestNic(cloudstackTestCase):
         try:
             self.apiclient = self.testClient.getApiClient()
             self.dbclient  = self.testClient.getDbConnection()
-            self.services  = Services().services
+            self.services  = self.testClient.getConfigParser().parsedDict
 
             # Get Zone, Domain and templates
             domain = get_domain(self.apiclient, self.services)
@@ -169,7 +68,7 @@ class TestNic(cloudstackTestCase):
             self.services["small"]["zoneid"] = zone.id
             self.services["small"]["template"] = template.id
 
-            self.services["iso"]["zoneid"] = zone.id
+            self.services["iso_1"]["zoneid"] = zone.id
             self.services["network"]["zoneid"] = zone.id
 
             # Create Account, VMs, NAT Rules etc

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/6a2cc9fb/test/integration/smoke/test_portable_publicip.py
----------------------------------------------------------------------
diff --git a/test/integration/smoke/test_portable_publicip.py b/test/integration/smoke/test_portable_publicip.py
index 0faed71..7eda7da 100644
--- a/test/integration/smoke/test_portable_publicip.py
+++ b/test/integration/smoke/test_portable_publicip.py
@@ -23,68 +23,6 @@ from marvin.integration.lib.base import *
 from marvin.integration.lib.common import *
 from nose.plugins.attrib import attr
 
-class Services:
-    """Test Data
-    """
-
-    def __init__(self):
-        self.services = {
-            "domain": {
-                "name": "Domain",
-            },
-            "account": {
-                "email": "test@test.com",
-                "firstname": "Test",
-                "lastname": "User",
-                "username": "test",
-                # Random characters are appended for unique
-                # username
-                "password": "password",
-            },
-            "service_offering": {
-                "name": "Tiny Instance",
-                "displaytext": "Tiny Instance",
-                "cpunumber": 1,
-                "cpuspeed": 100,
-                # in MHz
-                "memory": 128,
-                # In MBs
-            },
-            "network_offering": {
-                    "name": 'Test Network offering',
-                    "displaytext": 'Test Network offering',
-                    "guestiptype": 'Isolated',
-                    "supportedservices": 'Dhcp,Dns,SourceNat,PortForwarding',
-                    "traffictype": 'GUEST',
-                    "availability": 'Optional',
-                    "serviceProviderList" : {
-                            "Dhcp": 'VirtualRouter',
-                            "Dns": 'VirtualRouter',
-                            "SourceNat": 'VirtualRouter',
-                            "PortForwarding": 'VirtualRouter',
-                        },
-            },
-            "network": {
-                "name": "Test Network",
-                "displaytext": "Test Network",
-            },
-            "ostype": 'CentOS 5.3 (64-bit)',
-            "gateway" : "172.1.1.1",
-            "netmask" : "255.255.255.0",
-            "startip" : "172.1.1.10",
-            "endip" : "172.1.1.20",
-            "regionid" : "1",
-            "vlan" :"10",
-            "isportable" : "true",
-            "virtual_machine" : {
-                "affinity": {
-                    "name": "webvms",
-                    "type": "host anti-affinity",
-                },
-                "hypervisor" : "XenServer",
-            }
-        }
-
 class TestPortablePublicIPRange(cloudstackTestCase):
 
     """
@@ -95,8 +33,10 @@ class TestPortablePublicIPRange(cloudstackTestCase):
     """
     @classmethod
     def setUpClass(cls):
-        cls.api_client = super(TestPortablePublicIPRange, cls).getClsTestClient().getApiClient()
-        cls.services = Services().services
+        cloudstackTestClient = super(TestPortablePublicIPRange, cls).getClsTestClient()
+        cls.api_client = cloudstackTestClient.getApiClient()
+        cls.services = cloudstackTestClient.getConfigParser().parsedDict
+
         # Get Zone, Domain
         cls.domain = get_domain(cls.api_client, cls.services)
         cls.zone = get_zone(cls.api_client, cls.services)
@@ -161,8 +101,10 @@ class TestPortablePublicIPAcquire(cloudstackTestCase):
     """
     @classmethod
     def setUpClass(cls):
-        cls.api_client = super(TestPortablePublicIPAcquire, cls).getClsTestClient().getApiClient()
-        cls.services = Services().services
+        cloudstackTestClient = super(TestPortablePublicIPAcquire, cls).getClsTestClient()
+        cls.api_client = cloudstackTestClient.getApiClient()
+        cls.services = cloudstackTestClient.getConfigParser().parsedDict
+
         # Get Zone, Domain
         cls.domain = get_domain(cls.api_client, cls.services)
         cls.zone = get_zone(cls.api_client, cls.services)

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/6a2cc9fb/test/integration/smoke/test_primary_storage.py
----------------------------------------------------------------------
diff --git a/test/integration/smoke/test_primary_storage.py b/test/integration/smoke/test_primary_storage.py
index 5cf31b1..a142a27 100644
--- a/test/integration/smoke/test_primary_storage.py
+++ b/test/integration/smoke/test_primary_storage.py
@@ -29,31 +29,12 @@ from nose.plugins.attrib import attr
 import time
 _multiprocess_shared_ = True
 
-class Services:
-    """Test Primary storage Services
-    """
-
-    def __init__(self):
-        self.services = {
-                        "nfs":
-                             {
-                                "url": "nfs://10.147.28.7/export/home/talluri/testprimary",
-                                # Format: File_System_Type/Location/Path
-                                "name": "Primary XEN"
-                            },
-                        "iscsi": {
-                                "url": "iscsi://192.168.100.21/iqn.2012-01.localdomain.clo-cstack-cos6:iser/1",
-                                # Format : iscsi://IP Address/IQN number/LUN#
-                                "name": "Primary iSCSI"
-                            }
-                 }
-
 class TestPrimaryStorageServices(cloudstackTestCase):
 
     def setUp(self):
 
         self.apiclient = self.testClient.getApiClient()
-        self.services = Services().services
+        self.services = self.testClient.getConfigParser().parsedDict
         self.cleanup = []
         # Get Zone and pod
         self.zone = get_zone(self.apiclient, self.services)

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/6a2cc9fb/test/integration/smoke/test_public_ip_range.py
----------------------------------------------------------------------
diff --git a/test/integration/smoke/test_public_ip_range.py b/test/integration/smoke/test_public_ip_range.py
index e1d78d9..f2cb2df 100644
--- a/test/integration/smoke/test_public_ip_range.py
+++ b/test/integration/smoke/test_public_ip_range.py
@@ -26,32 +26,6 @@ from marvin.integration.lib.base import *
 from marvin.integration.lib.common import *
 import datetime
 
-class Services:
-    """Test Dedicating Public IP addresses
-    """
-
-    def __init__(self):
-        self.services = {
-                        "domain": {
-                                   "name": "Domain",
-                                   },
-                        "account": {
-                                    "email": "test@test.com",
-                                    "firstname": "Test",
-                                    "lastname": "User",
-                                    "username": "test",
-                                    "password": "password",
-                         },
-                        "gateway": "10.102.197.1",
-                        "netmask": "255.255.255.0",
-                        "forvirtualnetwork": "true",
-                        "startip": "10.102.197.70",
-                        "endip": "10.102.197.73",
-                        "zoneid": "1",
-                        "podid": "",
-                        "vlan": "4444",
-                    }
-
 class TestDedicatePublicIPRange(cloudstackTestCase):
 
     @classmethod

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/6a2cc9fb/test/integration/smoke/test_regions.py
----------------------------------------------------------------------
diff --git a/test/integration/smoke/test_regions.py b/test/integration/smoke/test_regions.py
index 5d12e74..288c3e6 100644
--- a/test/integration/smoke/test_regions.py
+++ b/test/integration/smoke/test_regions.py
@@ -22,25 +22,16 @@ from marvin.integration.lib.base import *
 from marvin.integration.lib.common import *
 from nose.plugins.attrib import attr
 
-class Services:
-    def __init__(self):
-        self.services = {
-            "region": {
-                "regionid": "2",
-                "regionname": "Region2",
-                "regionendpoint": "http://region2:8080/client"
-            }
-        }
-
-
 class TestRegions(cloudstackTestCase):
     """Test Regions - basic region creation
     """
 
     @classmethod
     def setUpClass(cls):
-        cls.api_client = super(TestRegions, cls).getClsTestClient().getApiClient()
-        cls.services = Services().services
+        cloudstackTestClient = super(TestRegions, cls).getClsTestClient()
+        cls.api_client = cloudstackTestClient.getApiClient()
+        cls.services = cloudstackTestClient.getConfigParser().parsedDict
+
         cls.domain = get_domain(cls.api_client, cls.services)
         cls.cleanup = []
 
@@ -90,4 +81,4 @@ class TestRegions(cloudstackTestCase):
             list_region = Region.list(cls.api_client, id=cls.services["region"]["regionid"])
             assert list_region is None, "Region deletion fails"
         except Exception as e:
-            raise Exception("Warning: Region cleanup/delete fails with : %s" % e)
\ No newline at end of file
+            raise Exception("Warning: Region cleanup/delete fails with : %s" % e)

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/6a2cc9fb/test/integration/smoke/test_reset_vm_on_reboot.py
----------------------------------------------------------------------
diff --git a/test/integration/smoke/test_reset_vm_on_reboot.py b/test/integration/smoke/test_reset_vm_on_reboot.py
index 4e52f0f..61e5178 100644
--- a/test/integration/smoke/test_reset_vm_on_reboot.py
+++ b/test/integration/smoke/test_reset_vm_on_reboot.py
@@ -27,66 +27,12 @@ from nose.plugins.attrib import attr
 
 _multiprocess_shared_ = True
 
-class Services:
-    """Test VM Life Cycle Services
-    """
-
-    def __init__(self):
-        self.services = {
-
-            "account": {
-                "email": "test@test.com",
-                "firstname": "Test",
-                "lastname": "User",
-                "username": "test",
-                # Random characters are appended in create account to
-                # ensure unique username generated each time
-                "password": "password",
-            },
-            "small":
-            # Create a small virtual machine instance with disk offering
-                {
-                    "displayname": "testserver",
-                    "username": "root", # VM creds for SSH
-                    "password": "password",
-                    "ssh_port": 22,
-                    "hypervisor": 'XenServer',
-                    "privateport": 22,
-                    "publicport": 22,
-                    "protocol": 'TCP',
-                },
-            "service_offerings":
-                {
-                    "small":
-                        {
-                            # Small service offering ID to for change VM
-                            # service offering from medium to small
-                            "name": "SmallInstance_volatile",
-                            "displaytext": "SmallInstance_volatile",
-                            "cpunumber": 1,
-                            "cpuspeed": 100,
-                            "memory": 256,
-                        },
-                },
-            #Change this
-            "template": {
-                "displaytext": "xs",
-                "name": "xs",
-                "passwordenabled": False,
-            },
-            "sleep": 60,
-            "timeout": 10,
-            #Migrate VM to hostid
-            "ostype": 'CentOS 5.3 (64-bit)',
-            # CentOS 5.3 (64-bit)
-        }
-
-
 class TestResetVmOnReboot(cloudstackTestCase):
     @classmethod
     def setUpClass(cls):
-        cls.api_client = super(TestResetVmOnReboot, cls).getClsTestClient().getApiClient()
-        cls.services = Services().services
+        cloudstackTestClient = super(TestResetVmOnReboot, cls).getClsTestClient()
+        cls.api_client = cloudstackTestClient.getApiClient()
+        cls.services = cloudstackTestClient.getConfigParser().parsedDict        
 
         # Get Zone, Domain and templates
         domain = get_domain(cls.api_client, cls.services)

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/6a2cc9fb/test/integration/smoke/test_resource_detail.py
----------------------------------------------------------------------
diff --git a/test/integration/smoke/test_resource_detail.py b/test/integration/smoke/test_resource_detail.py
index 00a7b5c..054ee42 100644
--- a/test/integration/smoke/test_resource_detail.py
+++ b/test/integration/smoke/test_resource_detail.py
@@ -29,81 +29,14 @@ from nose.plugins.attrib import attr
 import time
 
 _multiprocess_shared_ = True
-class Services:
-    """Test VM Life Cycle Services
-    """
-
-    def __init__(self):
-        self.services = {
-
-                "account": {
-                    "email": "test@test.com",
-                    "firstname": "Test",
-                    "lastname": "User",
-                    "username": "test",
-                    # Random characters are appended in create account to 
-                    # ensure unique username generated each time
-                    "password": "password",
-                },
-                "small":
-                # Create a small virtual machine instance with disk offering 
-                {
-                    "displayname": "testserver",
-                    "username": "root", # VM creds for SSH
-                    "password": "password",
-                    "ssh_port": 22,
-                    "hypervisor": 'XenServer',
-                    "privateport": 22,
-                    "publicport": 22,
-                    "protocol": 'TCP',
-                },
-                "disk_offering": {
-                            "displaytext": "Small",
-                            "name": "Small",
-                            "storagetype": "shared",
-                            "disksize": 1
-                },
-                "service_offerings":
-                {
-                 "small":
-                    {
-                     # Small service offering ID to for change VM 
-                     # service offering from medium to small
-                        "name": "SmallInstance",
-                        "displaytext": "SmallInstance",
-                        "cpunumber": 1,
-                        "cpuspeed": 100,
-                        "memory": 256,
-                    },
-                "big":
-                    {
-                     # Big service offering ID to for change VM 
-                        "name": "BigInstance",
-                        "displaytext": "BigInstance",
-                        "cpunumber": 1,
-                        "cpuspeed": 100,
-                        "memory": 512,
-                    }
-                },
-                #Change this
-                "template": {
-                    "displaytext": "xs",
-                    "name": "xs",
-                    "passwordenabled": False,
-                },
-            "sleep": 60,
-            "timeout": 10,
-            #Migrate VM to hostid
-            "ostype": 'CentOS 5.6 (64-bit)',
-            # CentOS 5.3 (64-bit)
-        }
 
 class TestResourceDetail(cloudstackTestCase):
 
     @classmethod
     def setUpClass(cls):
-        cls.api_client = super(TestResourceDetail, cls).getClsTestClient().getApiClient()
-        cls.services = Services().services
+        cloudstackTestClient = super(TestResourceDetail, cls).getClsTestClient()
+        cls.api_client = cloudstackTestClient.getApiClient()
+        cls.services = cloudstackTestClient.getConfigParser().parsedDict
 
         # Get Zone, Domain and templates
         domain = get_domain(cls.api_client, cls.services)

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/6a2cc9fb/test/integration/smoke/test_routers.py
----------------------------------------------------------------------
diff --git a/test/integration/smoke/test_routers.py b/test/integration/smoke/test_routers.py
index 7d32413..3f1ea92 100644
--- a/test/integration/smoke/test_routers.py
+++ b/test/integration/smoke/test_routers.py
@@ -30,53 +30,16 @@ import time
 
 
 _multiprocess_shared_ = True
-class Services:
-    """Test router Services
-    """
-
-    def __init__(self):
-        self.services = {
-                         "service_offering": {
-                                    "name": "Tiny Instance",
-                                    "displaytext": "Tiny Instance",
-                                    "cpunumber": 1,
-                                    "cpuspeed": 100, # in MHz
-                                    "memory": 128, # In MBs
-                                    },
-                        "virtual_machine":
-                                    {
-                                        "displayname": "Test VM",
-                                        "username": "root",
-                                        "password": "password",
-                                        "ssh_port": 22,
-                                        "hypervisor": 'XenServer',
-                                        "privateport": 22,
-                                        "publicport": 22,
-                                        "protocol": 'TCP',
-                                },
-                        "account": {
-                                        "email": "test@test.com",
-                                        "firstname": "Test",
-                                        "lastname": "User",
-                                        "username": "testuser",
-                                        "password": "password",
-                                        },
-                         "ostype": "CentOS 5.3 (64-bit)",
-                         "sleep": 60,
-                         "timeout": 10,
-                        }
-
 
 class TestRouterServices(cloudstackTestCase):
 
     @classmethod
     def setUpClass(cls):
 
-        cls.api_client = super(
-                               TestRouterServices,
-                               cls
-                               ).getClsTestClient().getApiClient()
-        cls.services = Services().services
+        cloudstackTestClient = super(TestRouterServices, cls).getClsTestClient()
+        cls.api_client = cloudstackTestClient.getApiClient()
+        cls.services = cloudstackTestClient.getConfigParser().parsedDict
+
         # Get Zone, Domain and templates
         cls.domain = get_domain(cls.api_client, cls.services)
         cls.zone = get_zone(cls.api_client, cls.services)
@@ -96,7 +59,7 @@ class TestRouterServices(cloudstackTestCase):
                                      )
         cls.service_offering = ServiceOffering.create(
                                             cls.api_client,
-                                            cls.services["service_offering"]
+                                            cls.services["service_offerings"]
                                             )
         cls.vm_1 = VirtualMachine.create(
                                     cls.api_client,

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/6a2cc9fb/test/integration/smoke/test_scale_vm.py
----------------------------------------------------------------------
diff --git a/test/integration/smoke/test_scale_vm.py b/test/integration/smoke/test_scale_vm.py
index 1d1726d..d7138bf 100644
--- a/test/integration/smoke/test_scale_vm.py
+++ b/test/integration/smoke/test_scale_vm.py
@@ -27,75 +27,12 @@ from nose.plugins.attrib import attr
 
 _multiprocess_shared_ = True
 
-class Services:
-    """Test VM Life Cycle Services
-    """
-
-    def __init__(self):
-        self.services = {
-
-            "account": {
-                "email": "test@test.com",
-                "firstname": "Test",
-                "lastname": "User",
-                "username": "test",
-                # Random characters are appended in create account to
-                # ensure unique username generated each time
-                "password": "password",
-            },
-            "small":
-            # Create a small virtual machine instance with disk offering
-                {
-                    "displayname": "testserver",
-                    "username": "root", # VM creds for SSH
-                    "password": "password",
-                    "ssh_port": 22,
-                    "hypervisor": 'XenServer',
-                    "privateport": 22,
-                    "publicport": 22,
-                    "protocol": 'TCP',
-                },
-            "service_offerings":
-                {
-                    "small":
-                        {
-                            # Small service offering ID to for change VM
-                            # service offering from medium to small
-                            "name": "SmallInstance",
-                            "displaytext": "SmallInstance",
-                            "cpunumber": 1,
-                            "cpuspeed": 100,
-                            "memory": 256,
-                        },
-                    "big":
-                        {
-                            # Big service offering ID to for change VM
-                            "name": "BigInstance",
-                            "displaytext": "BigInstance",
-                            "cpunumber": 1,
-                            "cpuspeed": 100,
-                            "memory": 512,
-                        }
-                },
-            #Change this
-            "template": {
-                "displaytext": "xs",
-                "name": "xs",
-                "passwordenabled": False,
-            },
-            "sleep": 60,
-            "timeout": 10,
-            #Migrate VM to hostid
-            "ostype": 'CentOS 5.3 (64-bit)',
-            # CentOS 5.3 (64-bit)
-        }
-
-
 class TestScaleVm(cloudstackTestCase):
     @classmethod
     def setUpClass(cls):
-        cls.api_client = super(TestScaleVm, cls).getClsTestClient().getApiClient()
-        cls.services = Services().services
+        cloudstackTestClient = super(TestScaleVm, cls).getClsTestClient()
+        cls.api_client = cloudstackTestClient.getApiClient()
+        cls.services = cloudstackTestClient.getConfigParser().parsedDict
 
         # Get Zone, Domain and templates
         domain = get_domain(cls.api_client, cls.services)

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/6a2cc9fb/test/integration/smoke/test_service_offerings.py
----------------------------------------------------------------------
diff --git a/test/integration/smoke/test_service_offerings.py b/test/integration/smoke/test_service_offerings.py
index 968dc56..095bbfd 100644
--- a/test/integration/smoke/test_service_offerings.py
+++ b/test/integration/smoke/test_service_offerings.py
@@ -35,93 +35,13 @@ from nose.plugins.attrib import attr
 
 _multiprocess_shared_ = True
 
-class Services:
-    """Test Service offerings Services
-    """
-
-    def __init__(self):
-        self.services = {
-            "account": {
-                "email": "test@test.com",
-                "firstname": "Test",
-                "lastname": "User",
-                "username": "test",
-                # Random characters are appended in create account to
-                # ensure unique username generated each time
-                "password": "password",
-                },
-            "off":
-                {
-                    "name": "Service Offering",
-                    "displaytext": "Service Offering",
-                    "cpunumber": 1,
-                    "cpuspeed": 100, # MHz
-                    "memory": 128, # in MBs
-                },
-            "small":
-            # Create a small virtual machine instance with disk offering
-                {
-                    "displayname": "testserver",
-                    "username": "root", # VM creds for SSH
-                    "password": "password",
-                    "ssh_port": 22,
-                    "hypervisor": 'XenServer',
-                    "privateport": 22,
-                    "publicport": 22,
-                    "protocol": 'TCP',
-                },
-            "medium": # Create a medium virtual machine instance
-                {
-                    "displayname": "testserver",
-                    "username": "root",
-                    "password": "password",
-                    "ssh_port": 22,
-                    "hypervisor": 'XenServer',
-                    "privateport": 22,
-                    "publicport": 22,
-                    "protocol": 'TCP',
-                },
-            "service_offerings":
-                {
-                    "tiny":
-                        {
-                            "name": "Tiny Instance",
-                            "displaytext": "Tiny Instance",
-                            "cpunumber": 1,
-                            "cpuspeed": 100, # in MHz
-                            "memory": 128, # In MBs
-                        },
-                    "small":
-                        {
-                            # Small service offering ID to for change VM
-                            # service offering from medium to small
-                            "name": "Small Instance",
-                            "displaytext": "Small Instance",
-                            "cpunumber": 1,
-                            "cpuspeed": 100,
-                            "memory": 128,
-                        },
-                    "medium":
-                        {
-                            # Medium service offering ID to for
-                            # change VM service offering from small to medium
-                            "name": "Medium Instance",
-                            "displaytext": "Medium Instance",
-                            "cpunumber": 1,
-                            "cpuspeed": 100,
-                            "memory": 256,
-                        }
-                },
-            "ostype": 'CentOS 5.3 (64-bit)',
-        }
-
 
 class TestCreateServiceOffering(cloudstackTestCase):
     def setUp(self):
         self.apiclient = self.testClient.getApiClient()
         self.dbclient = self.testClient.getDbConnection()
         self.cleanup = []
-        self.services = Services().services
+        self.services = self.testClient.getConfigParser().parsedDict
 
     def tearDown(self):
         try:
@@ -143,7 +63,7 @@ class TestCreateServiceOffering(cloudstackTestCase):
 
         service_offering = ServiceOffering.create(
             self.apiclient,
-            self.services["off"]
+            self.services["service_offerings"]
         )
         self.cleanup.append(service_offering)
 
@@ -168,27 +88,27 @@ class TestCreateServiceOffering(cloudstackTestCase):
 
         self.assertEqual(
             list_service_response[0].cpunumber,
-            self.services["off"]["cpunumber"],
+            self.services["service_offerings"]["cpunumber"],
             "Check server id in createServiceOffering"
         )
         self.assertEqual(
             list_service_response[0].cpuspeed,
-            self.services["off"]["cpuspeed"],
+            self.services["service_offerings"]["cpuspeed"],
             "Check cpuspeed in createServiceOffering"
         )
         self.assertEqual(
             list_service_response[0].displaytext,
-            self.services["off"]["displaytext"],
+            self.services["service_offerings"]["displaytext"],
             "Check server displaytext in createServiceOfferings"
         )
         self.assertEqual(
             list_service_response[0].memory,
-            self.services["off"]["memory"],
+            self.services["service_offerings"]["memory"],
             "Check memory in createServiceOffering"
         )
         self.assertEqual(
             list_service_response[0].name,
-            self.services["off"]["name"],
+            self.services["service_offerings"]["name"],
             "Check name in createServiceOffering"
         )
         return
@@ -212,19 +132,21 @@ class TestServiceOfferings(cloudstackTestCase):
 
     @classmethod
     def setUpClass(cls):
-        cls.api_client = super(TestServiceOfferings, cls).getClsTestClient().getApiClient()
-        cls.services = Services().services
+        cloudstackTestClient = super(TestServiceOfferings, cls).getClsTestClient()
+        cls.api_client = cloudstackTestClient.getApiClient()
+        cls.services = cloudstackTestClient.getConfigParser().parsedDict
+
         domain = get_domain(cls.api_client, cls.services)
         cls.zone = get_zone(cls.api_client, cls.services)
         cls.services['mode'] = cls.zone.networktype
 
         cls.service_offering_1 = ServiceOffering.create(
             cls.api_client,
-            cls.services["off"]
+            cls.services["service_offerings"]
         )
         cls.service_offering_2 = ServiceOffering.create(
             cls.api_client,
-            cls.services["off"]
+            cls.services["service_offerings"]
         )
         template = get_template(
                             cls.api_client,