You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by da...@apache.org on 2014/07/28 23:11:30 UTC

[1/3] CLOUDSTACK-5674:Fixed pep8 errors in python files in marvin folder Signed-off-by: SrikanteswaraRao Talluri

Repository: cloudstack
Updated Branches:
  refs/heads/4.4 e33d4a573 -> ee9613b65


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/4a99cf85/tools/marvin/marvin/lib/utils.py
----------------------------------------------------------------------
diff --git a/tools/marvin/marvin/lib/utils.py b/tools/marvin/marvin/lib/utils.py
index cb5dcfb..5178f5d 100644
--- a/tools/marvin/marvin/lib/utils.py
+++ b/tools/marvin/marvin/lib/utils.py
@@ -33,13 +33,14 @@ from platform import system
 from marvin.cloudstackException import GetDetailExceptionInfo
 from marvin.sshClient import SshClient
 from marvin.codes import (
-                          SUCCESS,
-                          FAIL,
-                          PASS,
-                          MATCH_NOT_FOUND,
-                          INVALID_INPUT,
-                          EMPTY_LIST,
-                          FAILED)
+    SUCCESS,
+    FAIL,
+    PASS,
+    MATCH_NOT_FOUND,
+    INVALID_INPUT,
+    EMPTY_LIST,
+    FAILED)
+
 
 def restart_mgmt_server(server):
     """Restarts the management server"""
@@ -121,7 +122,9 @@ def cleanup_resources(api_client, resources):
         obj.delete(api_client)
 
 
-def is_server_ssh_ready(ipaddress, port, username, password, retries=20, retryinterv=30, timeout=10.0, keyPairFileLocation=None):
+def is_server_ssh_ready(ipaddress, port, username, password,
+                        retries=20, retryinterv=30,
+                        timeout=10.0, keyPairFileLocation=None):
     '''
     @Name: is_server_ssh_ready
     @Input: timeout: tcp connection timeout flag,
@@ -141,8 +144,10 @@ def is_server_ssh_ready(ipaddress, port, username, password, retries=20, retryin
             retries=retries,
             delay=retryinterv,
             timeout=timeout)
-    except Exception, e:
-        raise Exception("SSH connection has Failed. Waited %ss. Error is %s" % (retries * retryinterv, str(e)))
+    except Exception as e:
+        raise Exception(
+            "SSH connection has Failed. Waited %ss. Error is %s" %
+            (retries * retryinterv, str(e)))
     else:
         return ssh
 
@@ -171,6 +176,7 @@ def fetch_api_client(config_file='datacenterCfg'):
         )
     )
 
+
 def get_host_credentials(config, hostip):
     """Get login information for a host `hostip` (ipv4) from marvin's `config`
 
@@ -186,26 +192,35 @@ def get_host_credentials(config, hostip):
                     try:
                         if socket.getfqdn(hostip) == socket.getfqdn(hostname):
                             return host.username, host.password
-                    except socket.error, e:
-                        raise Exception("Unresolvable host %s error is %s" % (hostip, e))
-    raise KeyError("Please provide the marvin configuration file with credentials to your hosts")
-
-
-def get_process_status(hostip, port, username, password, linklocalip, process, hypervisor=None):
+                    except socket.error as e:
+                        raise Exception(
+                            "Unresolvable host %s error is %s" %
+                            (hostip, e))
+    raise KeyError(
+        "Please provide the marvin configuration file "
+        "with credentials to your hosts")
+
+
+def get_process_status(
+        hostip, port, username, password,
+        linklocalip, process, hypervisor=None):
     """Double hop and returns a process status"""
 
-    #SSH to the machine
+    # SSH to the machine
     ssh = SshClient(hostip, port, username, password)
     if (str(hypervisor).lower() == 'vmware'
-		or str(hypervisor).lower() == 'hyperv'):
-        ssh_command = "ssh -i /var/cloudstack/management/.ssh/id_rsa -ostricthostkeychecking=no "
+            or str(hypervisor).lower() == 'hyperv'):
+        ssh_command =\
+            "ssh -i /var/cloudstack/management/" \
+            ".ssh/id_rsa -ostricthostkeychecking=no "
     else:
-        ssh_command = "ssh -i ~/.ssh/id_rsa.cloud -ostricthostkeychecking=no "
+        ssh_command = "ssh -i ~/.ssh/id_rsa.cloud " \
+                      "-ostricthostkeychecking=no "
 
     ssh_command = ssh_command +\
-                  "-oUserKnownHostsFile=/dev/null -p 3922 %s %s" % (
-                      linklocalip,
-                      process)
+        "-oUserKnownHostsFile=/dev/null -p 3922 %s %s" % (
+            linklocalip,
+            process)
 
     # Double hop into router
     timeout = 5
@@ -242,12 +257,13 @@ def xsplit(txt, seps):
     @return: list of split units
     """
     default_sep = seps[0]
-    for sep in seps[1:]: # we skip seps[0] because that's the default separator
+    # we skip seps[0] because that's the default separator
+    for sep in seps[1:]:
         txt = txt.replace(sep, default_sep)
     return [i.strip() for i in txt.split(default_sep)]
 
-def get_hypervisor_type(apiclient):
 
+def get_hypervisor_type(apiclient):
     """Return the hypervisor type of the hosts in setup"""
 
     cmd = listHosts.listHostsCmd()
@@ -255,62 +271,79 @@ def get_hypervisor_type(apiclient):
     cmd.listall = True
     hosts = apiclient.listHosts(cmd)
     hosts_list_validation_result = validateList(hosts)
-    assert hosts_list_validation_result[0] == PASS, "host list validation failed"
+    assert hosts_list_validation_result[
+        0] == PASS, "host list validation failed"
     return hosts_list_validation_result[1].hypervisor
 
+
 def is_snapshot_on_nfs(apiclient, dbconn, config, zoneid, snapshotid):
     """
-    Checks whether a snapshot with id (not UUID) `snapshotid` is present on the nfs storage
+    Checks whether a snapshot with id
+    (not UUID) `snapshotid` is present on the nfs storage
 
     @param apiclient: api client connection
     @param @dbconn:  connection to the cloudstack db
     @param config: marvin configuration file
-    @param zoneid: uuid of the zone on which the secondary nfs storage pool is mounted
+    @param zoneid: uuid of the zone on which the
+     secondary nfs storage pool is mounted
     @param snapshotid: uuid of the snapshot
     @return: True if snapshot is found, False otherwise
     """
     # snapshot extension to be appended to the snapshot path obtained from db
     snapshot_extensions = {"vmware": ".ovf",
-                            "kvm": "",
-                            "xenserver": ".vhd",
-                            "simulator":""}
+                           "kvm": "",
+                           "xenserver": ".vhd",
+                           "simulator": ""}
 
     qresultset = dbconn.execute(
-                        "select id from snapshots where uuid = '%s';" \
-                        % str(snapshotid)
-                        )
+        "select id from snapshots where uuid = '%s';"
+        % str(snapshotid)
+    )
     if len(qresultset) == 0:
         raise Exception(
             "No snapshot found in cloudstack with id %s" % snapshotid)
 
-
     snapshotid = qresultset[0][0]
     qresultset = dbconn.execute(
-        "select install_path,store_id from snapshot_store_ref where snapshot_id='%s' and store_role='Image';" % snapshotid
+        "select install_path,store_id from snapshot_store_ref"
+        " where snapshot_id='%s' and "
+        "store_role='Image';" % snapshotid
     )
 
-    assert isinstance(qresultset, list), "Invalid db query response for snapshot %s" % snapshotid
+    assert isinstance(
+        qresultset, list), "Invalid db query " \
+                           "response for snapshot " \
+                           "%s" % snapshotid
 
     if len(qresultset) == 0:
-        #Snapshot does not exist
+        # Snapshot does not exist
         return False
 
     from base import ImageStore
-    #pass store_id to get the exact storage pool where snapshot is stored
-    secondaryStores = ImageStore.list(apiclient, zoneid=zoneid, id=int(qresultset[0][1]))
-
-    assert isinstance(secondaryStores, list), "Not a valid response for listImageStores"
-    assert len(secondaryStores) != 0, "No image stores found in zone %s" % zoneid
+    # pass store_id to get the exact storage pool where snapshot is stored
+    secondaryStores = ImageStore.list(
+        apiclient,
+        zoneid=zoneid,
+        id=int(
+            qresultset[0][1]))
+
+    assert isinstance(
+        secondaryStores, list), "Not a valid response for listImageStores"
+    assert len(
+        secondaryStores) != 0, "No image stores found in zone %s" % zoneid
 
     secondaryStore = secondaryStores[0]
 
     if str(secondaryStore.providername).lower() != "nfs":
         raise Exception(
-            "is_snapshot_on_nfs works only against nfs secondary storage. found %s" % str(secondaryStore.providername))
+            "is_snapshot_on_nfs works only "
+            "against nfs secondary storage."
+            " found %s" % str(secondaryStore.providername))
 
     hypervisor = get_hypervisor_type(apiclient)
     # append snapshot extension based on hypervisor, to the snapshot path
-    snapshotPath = str(qresultset[0][0]) + snapshot_extensions[str(hypervisor).lower()]
+    snapshotPath = str(qresultset[0][0]) + \
+        snapshot_extensions[str(hypervisor).lower()]
 
     nfsurl = secondaryStore.url
     from urllib2 import urlparse
@@ -318,8 +351,11 @@ def is_snapshot_on_nfs(apiclient, dbconn, config, zoneid, snapshotid):
     host, path = parse_url.netloc, parse_url.path
 
     if not config.mgtSvr:
-        raise Exception("Your marvin configuration does not contain mgmt server credentials")
-    mgtSvr, user, passwd = config.mgtSvr[0].mgtSvrIp, config.mgtSvr[0].user, config.mgtSvr[0].passwd
+        raise Exception(
+            "Your marvin configuration does "
+            "not contain mgmt server credentials")
+    mgtSvr, user, passwd = config.mgtSvr[
+        0].mgtSvrIp, config.mgtSvr[0].user, config.mgtSvr[0].passwd
 
     try:
         ssh_client = SshClient(
@@ -329,32 +365,33 @@ def is_snapshot_on_nfs(apiclient, dbconn, config, zoneid, snapshotid):
             passwd
         )
         cmds = [
-                "mkdir -p %s /mnt/tmp",
-                "mount -t %s %s%s /mnt/tmp" % (
-                    'nfs',
-                    host,
-                    path,
-                    ),
-                "test -f %s && echo 'snapshot exists'" % (
-                    os.path.join("/mnt/tmp", snapshotPath)
-                    ),
-            ]
+            "mkdir -p %s /mnt/tmp",
+            "mount -t %s %s%s /mnt/tmp" % (
+                'nfs',
+                host,
+                path,
+            ),
+            "test -f %s && echo 'snapshot exists'" % (
+                os.path.join("/mnt/tmp", snapshotPath)
+            ),
+        ]
 
         for c in cmds:
             result = ssh_client.execute(c)
 
         # Unmount the Sec Storage
         cmds = [
-                "cd",
-                "umount /mnt/tmp",
-            ]
+            "cd",
+            "umount /mnt/tmp",
+        ]
         for c in cmds:
             ssh_client.execute(c)
     except Exception as e:
         raise Exception("SSH failed for management server: %s - %s" %
-                      (config.mgtSvr[0].mgtSvrIp, e))
+                        (config.mgtSvr[0].mgtSvrIp, e))
     return 'snapshot exists' in result
 
+
 def validateList(inp):
     """
     @name: validateList
@@ -388,7 +425,8 @@ def validateList(inp):
         return ret
     return [PASS, inp[0], None]
 
-def verifyElementInList(inp, toverify, responsevar=None,  pos=0):
+
+def verifyElementInList(inp, toverify, responsevar=None, pos=0):
     '''
     @name: verifyElementInList
     @Description:
@@ -400,9 +438,9 @@ def verifyElementInList(inp, toverify, responsevar=None,  pos=0):
     at a given pos
     @Input:
              I   : Input to be verified whether its a list or not
-             II  : Element to verify whether it exists in the list 
-             III : variable name in response object to verify 
-                   default to None, if None, we will verify for the complete 
+             II  : Element to verify whether it exists in the list
+             III : variable name in response object to verify
+                   default to None, if None, we will verify for the complete
                    first element EX: state of response object object
              IV  : Position in the list at which the input element to verify
                    default to 0
@@ -425,25 +463,29 @@ def verifyElementInList(inp, toverify, responsevar=None,  pos=0):
         return [FAIL, out[2]]
     if len(inp) > pos:
         if responsevar is None:
-                if inp[pos] == toverify:
-                    return [PASS, None]
+            if inp[pos] == toverify:
+                return [PASS, None]
         else:
-                if responsevar in inp[pos].__dict__ and getattr(inp[pos], responsevar) == toverify:
-                    return [PASS, None]
-                else:
-                    return [FAIL, MATCH_NOT_FOUND]
+            if responsevar in inp[pos].\
+               __dict__ and getattr(inp[pos], responsevar) == toverify:
+                return [PASS, None]
+            else:
+                return [FAIL, MATCH_NOT_FOUND]
     else:
         return [FAIL, MATCH_NOT_FOUND]
 
+
 def checkVolumeSize(ssh_handle=None,
                     volume_name="/dev/sda",
                     cmd_inp="/sbin/fdisk -l | grep Disk",
                     size_to_verify=0):
     '''
     @Name : getDiskUsage
-    @Desc : provides facility to verify the volume size against the size to verify
+    @Desc : provides facility to verify the
+    volume size against the size to verify
     @Input: 1. ssh_handle : machine against which to execute the disk size cmd
-            2. volume_name : The name of the volume against which to verify the size
+            2. volume_name : The name of the volume
+             against which to verify the size
             3. cmd_inp : Input command used to veify the size
             4. size_to_verify: size against which to compare.
     @Output: Returns FAILED in case of an issue, else SUCCESS
@@ -465,14 +507,14 @@ def checkVolumeSize(ssh_handle=None,
                 if volume_name in line:
                     parts = line.split()
                     if str(parts[-2]) == str(size_to_verify):
-                        return [SUCCESS,str(parts[-2])]
-            return [FAILED,"Volume Not Found"]
-    except Exception, e:
+                        return [SUCCESS, str(parts[-2])]
+            return [FAILED, "Volume Not Found"]
+    except Exception as e:
         print "\n Exception Occurred under getDiskUsage: " \
-              "%s" %GetDetailExceptionInfo(e)
-        return [FAILED,GetDetailExceptionInfo(e)]
+              "%s" % GetDetailExceptionInfo(e)
+        return [FAILED, GetDetailExceptionInfo(e)]
+
 
-        
 def verifyRouterState(apiclient, routerid, allowedstates):
     """List the router and verify that its state is in allowed states
     @output: List, containing [Result, Reason]
@@ -492,7 +534,7 @@ def verifyRouterState(apiclient, routerid, allowedstates):
     if listvalidationresult[0] == FAIL:
         return [FAIL, listvalidationresult[2]]
     if routers[0].redundantstate not in allowedstates:
-        return [FAIL, "Redundant state of the router should be in %s but is %s" %
-            (allowedstates, routers[0].redundantstate)]
+        return [FAIL, "Redundant state of the"
+                      " router should be in %s but is %s" %
+                (allowedstates, routers[0].redundantstate)]
     return [PASS, None]
-        
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/4a99cf85/tools/marvin/marvin/marvinInit.py
----------------------------------------------------------------------
diff --git a/tools/marvin/marvin/marvinInit.py b/tools/marvin/marvin/marvinInit.py
index c35fec6..de580ce 100644
--- a/tools/marvin/marvin/marvinInit.py
+++ b/tools/marvin/marvin/marvinInit.py
@@ -134,11 +134,11 @@ class MarvinInit:
         '''
         try:
             if ((self.__parseConfig() != FAILED) and
-                (self.__setHypervisorAndZoneInfo())and
-               (self.__setTestDataPath() != FAILED) and
-               (self.__initLogging() != FAILED) and
-               (self.__createTestClient() != FAILED) and
-               (self.__deployDC() != FAILED)):
+                    (self.__setHypervisorAndZoneInfo())and
+                    (self.__setTestDataPath() != FAILED) and
+                    (self.__initLogging() != FAILED) and
+                    (self.__createTestClient() != FAILED) and
+                    (self.__deployDC() != FAILED)):
                 return SUCCESS
             return FAILED
         except Exception as e:
@@ -187,7 +187,8 @@ class MarvinInit:
         try:
             mgt_details = self.__parsedConfig.mgtSvr[0]
             dbsvr_details = self.__parsedConfig.dbSvr
-            self.__testClient = CSTestClient(mgt_details, dbsvr_details,
+            self.__testClient = CSTestClient(mgt_details,
+                                             dbsvr_details,
                                              logger=self.__tcRunLogger,
                                              test_data_filepath=
                                              self.__testDataFilePath,

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/4a99cf85/tools/marvin/marvin/marvinPlugin.py
----------------------------------------------------------------------
diff --git a/tools/marvin/marvin/marvinPlugin.py b/tools/marvin/marvin/marvinPlugin.py
index 98bbb3f..71f81ad 100644
--- a/tools/marvin/marvin/marvinPlugin.py
+++ b/tools/marvin/marvin/marvinPlugin.py
@@ -302,6 +302,6 @@ class MarvinPlugin(Plugin):
                 cmd = "mv " + src + " " + dst
                 os.system(cmd)
                 print "===final results are now copied to: %s===" % str(dst)
-        except Exception, e:
+        except Exception as e:
             print "=== Exception occurred under finalize :%s ===" % \
                   str(GetDetailExceptionInfo(e))

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/4a99cf85/tools/marvin/marvin/sshClient.py
----------------------------------------------------------------------
diff --git a/tools/marvin/marvin/sshClient.py b/tools/marvin/marvin/sshClient.py
index e1c62c0..df2eeee 100644
--- a/tools/marvin/marvin/sshClient.py
+++ b/tools/marvin/marvin/sshClient.py
@@ -202,9 +202,9 @@ class SshClient(object):
         self.close()
 
     def close(self):
-            if self.ssh is not None:
-                self.ssh.close()
-                self.ssh = None
+        if self.ssh is not None:
+            self.ssh.close()
+            self.ssh = None
 
 
 if __name__ == "__main__":


[3/3] git commit: updated refs/heads/4.4 to ee9613b

Posted by da...@apache.org.
1. More fixes for smoke and component tests
2. Removed test_data.cfg file
3. Fixes to marvin libraries

(cherry picked from commit 9bba24812e4f58e6c503010823533b8e0047ea2a)


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

Branch: refs/heads/4.4
Commit: ee9613b6509c715e5de9f44bf131b82de179501b
Parents: 4a99cf8
Author: SrikanteswaraRao Talluri <ta...@apache.org>
Authored: Thu May 1 01:09:15 2014 +0530
Committer: Daan Hoogland <da...@onecht.net>
Committed: Mon Jul 28 23:11:07 2014 +0200

----------------------------------------------------------------------
 .../component/test_multiple_ips_per_nic.py      |   6 +-
 .../smoke/test_deploy_vm_root_resize.py         |  12 +-
 test/integration/smoke/test_iso.py              |  24 +-
 test/integration/smoke/test_network.py          |   6 +-
 test/integration/smoke/test_routers.py          |  41 +-
 test/integration/smoke/test_vm_life_cycle.py    |   6 +-
 tools/marvin/marvin/config/test_data.cfg        | 427 -------------------
 tools/marvin/marvin/config/test_data.py         |   1 +
 tools/marvin/marvin/lib/base.py                 |   2 +-
 tools/marvin/marvin/lib/utils.py                |   2 +-
 10 files changed, 61 insertions(+), 466 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/ee9613b6/test/integration/component/test_multiple_ips_per_nic.py
----------------------------------------------------------------------
diff --git a/test/integration/component/test_multiple_ips_per_nic.py b/test/integration/component/test_multiple_ips_per_nic.py
index abe9474..042e495 100644
--- a/test/integration/component/test_multiple_ips_per_nic.py
+++ b/test/integration/component/test_multiple_ips_per_nic.py
@@ -150,7 +150,7 @@ class TestBasicOperations(cloudstackTestCase):
                                                                       cls.services["shared_network_offering_all_services"])
         cls._cleanup.append(cls.shared_network_offering)
         cls.mode = cls.zone.networktype
-        if cls.mode == "advanced":
+        if cls.mode.lower() == "advanced":
             cls.isolated_network_offering = CreateEnabledNetworkOffering(cls.api_client,
                                                                       cls.services["isolated_network_offering"])
             cls._cleanup.append(cls.isolated_network_offering)
@@ -501,7 +501,7 @@ class TestNetworkRules(cloudstackTestCase):
                                         cls.services["shared_network_offering_all_services"])
         cls._cleanup.append(cls.shared_network_offering)
         cls.mode = cls.zone.networktype
-        if cls.mode == "advanced":
+        if cls.mode.lower() == "advanced":
             cls.isolated_network_offering = CreateEnabledNetworkOffering(cls.api_client, cls.services["isolated_network_offering"])
             cls._cleanup.append(cls.isolated_network_offering)
             cls.isolated_network_offering_vpc = CreateEnabledNetworkOffering(cls.api_client, cls.services["nw_offering_isolated_vpc"])
@@ -876,7 +876,7 @@ class TestVmNetworkOperations(cloudstackTestCase):
                                         cls.services["shared_network_offering_all_services"])
         cls._cleanup.append(cls.shared_network_offering)
         cls.mode = cls.zone.networktype
-        if cls.mode == "advanced":
+        if cls.mode.lower() == "advanced":
             cls.isolated_network_offering = CreateEnabledNetworkOffering(cls.api_client, cls.services["isolated_network_offering"])
             cls._cleanup.append(cls.isolated_network_offering)
             cls.isolated_network_offering_vpc = CreateEnabledNetworkOffering(cls.api_client, cls.services["nw_offering_isolated_vpc"])

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/ee9613b6/test/integration/smoke/test_deploy_vm_root_resize.py
----------------------------------------------------------------------
diff --git a/test/integration/smoke/test_deploy_vm_root_resize.py b/test/integration/smoke/test_deploy_vm_root_resize.py
index 8097d08..5d73876 100644
--- a/test/integration/smoke/test_deploy_vm_root_resize.py
+++ b/test/integration/smoke/test_deploy_vm_root_resize.py
@@ -122,7 +122,8 @@ class TestDeployVM(cloudstackTestCase):
                 domainid=self.account.domainid,
                 serviceofferingid=self.service_offering.id,
                 templateid=self.template.id,
-                rootdisksize=newrootsize
+                rootdisksize=newrootsize,
+                hypervisor=self.hypervisor
             )
 
             list_vms = VirtualMachine.list(self.apiclient, id=self.virtual_machine.id)
@@ -192,7 +193,8 @@ class TestDeployVM(cloudstackTestCase):
                     domainid=self.account.domainid,
                     serviceofferingid=self.service_offering.id,
                     templateid=self.template.id,
-                    rootdisksize=newrootsize
+                    rootdisksize=newrootsize,
+                    hypervisor=self.hypervisor
                 )
             except Exception as ex:
                 if "Hypervisor XenServer does not support rootdisksize override" in str(ex):
@@ -218,7 +220,8 @@ class TestDeployVM(cloudstackTestCase):
                     domainid=self.account.domainid,
                     serviceofferingid=self.service_offering.id,
                     templateid=self.template.id,
-                    rootdisksize=newrootsize
+                    rootdisksize=newrootsize,
+                    hypervisor=self.hypervisor
                 )
             except Exception as ex:
                 if "rootdisk size should be a non zero number" in str(ex):
@@ -249,7 +252,8 @@ class TestDeployVM(cloudstackTestCase):
                     domainid=self.account.domainid,
                     serviceofferingid=self.service_offering.id,
                     templateid=self.template.id,
-                    rootdisksize=newrootsize
+                    rootdisksize=newrootsize,
+                    hypervisor=self.hypervisor
                 )
             except Exception as ex:
                 if "rootdisksize override is smaller than template size" in str(ex):

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/ee9613b6/test/integration/smoke/test_iso.py
----------------------------------------------------------------------
diff --git a/test/integration/smoke/test_iso.py b/test/integration/smoke/test_iso.py
index 4a22850..d394c27 100644
--- a/test/integration/smoke/test_iso.py
+++ b/test/integration/smoke/test_iso.py
@@ -340,18 +340,6 @@ class TestISO(cloudstackTestCase):
         cmd.mode = self.services["iso2"]["mode"]
         cmd.zoneid = self.services["iso2"]["zoneid"]
         list_extract_response = self.apiclient.extractIso(cmd)
-
-        try:
-            #Format URL to ASCII to retrieve response code
-            formatted_url = urllib.unquote_plus(list_extract_response.url)
-            url_response = urllib.urlopen(formatted_url)
-            response_code = url_response.getcode()
-        except Exception:
-            self.fail(
-                "Extract ISO Failed with invalid URL %s (ISO id: %s)" \
-                % (formatted_url, self.iso_2.id)
-            )
-
         self.assertEqual(
                             list_extract_response.id,
                             self.iso_2.id,
@@ -367,6 +355,18 @@ class TestISO(cloudstackTestCase):
                             self.services["iso2"]["zoneid"],
                             "Check zone ID of extraction"
                         )
+
+        try:
+            #Format URL to ASCII to retrieve response code
+            formatted_url = urllib.unquote_plus(list_extract_response.url)
+            url_response = urllib.urlopen(formatted_url)
+            response_code = url_response.getcode()
+        except Exception:
+            self.fail(
+                "Extract ISO Failed with invalid URL %s (ISO id: %s)" \
+                % (formatted_url, self.iso_2.id)
+            )
+
         self.assertEqual(
                          response_code,
                          200,

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/ee9613b6/test/integration/smoke/test_network.py
----------------------------------------------------------------------
diff --git a/test/integration/smoke/test_network.py b/test/integration/smoke/test_network.py
index bf460da..4100878 100644
--- a/test/integration/smoke/test_network.py
+++ b/test/integration/smoke/test_network.py
@@ -633,7 +633,8 @@ class TestRebootRouter(cloudstackTestCase):
         routers = list_routers(
                                 self.apiclient,
                                 account=self.account.name,
-                                domainid=self.account.domainid
+                                domainid=self.account.domainid,
+                                listall=True
                                )
         self.assertEqual(
                             isinstance(routers, list),
@@ -949,7 +950,8 @@ class TestDeleteAccount(cloudstackTestCase):
             routers = list_routers(
                           self.apiclient,
                           account=self.account.name,
-                          domainid=self.account.domainid
+                          domainid=self.account.domainid,
+                          listall=True
                         )
             self.assertEqual(
                              routers,

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/ee9613b6/test/integration/smoke/test_routers.py
----------------------------------------------------------------------
diff --git a/test/integration/smoke/test_routers.py b/test/integration/smoke/test_routers.py
index 1c8e747..d503af1 100644
--- a/test/integration/smoke/test_routers.py
+++ b/test/integration/smoke/test_routers.py
@@ -111,13 +111,14 @@ class TestRouterServices(cloudstackTestCase):
         if self.zone.networktype == "Basic":
             list_router_response = list_routers(
                 self.apiclient,
-                listall="true"
+                listall=True
             )
         else:
             list_router_response = list_routers(
                 self.apiclient,
                 account=self.account.name,
-                domainid=self.account.domainid
+                domainid=self.account.domainid,
+                listall=True
             )
         self.assertEqual(
                             isinstance(list_router_response, list),
@@ -196,7 +197,8 @@ class TestRouterServices(cloudstackTestCase):
         list_router_response = list_routers(
                                     self.apiclient,
                                     account=self.account.name,
-                                    domainid=self.account.domainid
+                                    domainid=self.account.domainid,
+                                    listall=True
                                     )
         self.assertEqual(
                             isinstance(list_router_response, list),
@@ -303,7 +305,8 @@ class TestRouterServices(cloudstackTestCase):
         list_router_response = list_routers(
                                     self.apiclient,
                                     account=self.account.name,
-                                    domainid=self.account.domainid
+                                    domainid=self.account.domainid,
+                                    listall=True
                                     )
         self.assertEqual(
                             isinstance(list_router_response, list),
@@ -351,7 +354,8 @@ class TestRouterServices(cloudstackTestCase):
         list_router_response = list_routers(
                                     self.apiclient,
                                     account=self.account.name,
-                                    domainid=self.account.domainid
+                                    domainid=self.account.domainid,
+                                    listall=True
                                     )
         self.assertEqual(
                             isinstance(list_router_response, list),
@@ -413,7 +417,8 @@ class TestRouterServices(cloudstackTestCase):
         list_router_response = list_routers(
                                     self.apiclient,
                                     account=self.account.name,
-                                    domainid=self.account.domainid
+                                    domainid=self.account.domainid,
+                                    listall=True
                                     )
         self.assertEqual(
                             isinstance(list_router_response, list),
@@ -495,7 +500,8 @@ class TestRouterServices(cloudstackTestCase):
         list_router_response = list_routers(
                                         self.apiclient,
                                         account=self.account.name,
-                                        domainid=self.account.domainid
+                                        domainid=self.account.domainid,
+                                        listall=True
                                         )
         self.assertEqual(
                             isinstance(list_router_response, list),
@@ -561,7 +567,8 @@ class TestRouterServices(cloudstackTestCase):
         list_router_response = list_routers(
                                     self.apiclient,
                                     account=self.account.name,
-                                    domainid=self.account.domainid
+                                    domainid=self.account.domainid,
+                                    listall=True
                                     )
         self.assertEqual(
                             isinstance(list_router_response, list),
@@ -642,7 +649,8 @@ class TestRouterServices(cloudstackTestCase):
         list_router_response = list_routers(
                                     self.apiclient,
                                     account=self.account.name,
-                                    domainid=self.account.domainid
+                                    domainid=self.account.domainid,
+                                    listall=True
                                     )
         self.assertEqual(
                             isinstance(list_router_response, list),
@@ -659,7 +667,8 @@ class TestRouterServices(cloudstackTestCase):
         #List routers to check state of router
         router_response = list_routers(
                                     self.apiclient,
-                                    id=router.id
+                                    id=router.id,
+                                    listall=True
                                     )
         self.assertEqual(
                             isinstance(router_response, list),
@@ -685,7 +694,8 @@ class TestRouterServices(cloudstackTestCase):
         list_router_response = list_routers(
                                     self.apiclient,
                                     account=self.account.name,
-                                    domainid=self.account.domainid
+                                    domainid=self.account.domainid,
+                                    listall=True
                                     )
         self.assertEqual(
                             isinstance(list_router_response, list),
@@ -704,7 +714,8 @@ class TestRouterServices(cloudstackTestCase):
         #List routers to check state of router
         router_response = list_routers(
                                     self.apiclient,
-                                    id=router.id
+                                    id=router.id,
+                                    listall=True
                                     )
         self.assertEqual(
                             isinstance(router_response, list),
@@ -737,7 +748,8 @@ class TestRouterServices(cloudstackTestCase):
         list_router_response = list_routers(
                                     self.apiclient,
                                     account=self.account.name,
-                                    domainid=self.account.domainid
+                                    domainid=self.account.domainid,
+                                    listall=True
                                     )
         self.assertEqual(
                             isinstance(list_router_response, list),
@@ -759,7 +771,8 @@ class TestRouterServices(cloudstackTestCase):
         while retries_cnt >= 0:
             router_response = list_routers(
                                     self.apiclient,
-                                    id=router.id
+                                    id=router.id,
+                                    listall=True
                                     )
             if self.verifyRouterResponse(router_response,public_ip):
                 self.debug("Router is running successfully after reboot")

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/ee9613b6/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 2219d08..6f3e46a 100644
--- a/test/integration/smoke/test_vm_life_cycle.py
+++ b/test/integration/smoke/test_vm_life_cycle.py
@@ -159,7 +159,8 @@ class TestDeployVM(cloudstackTestCase):
         3. Has a linklocalip, publicip and a guestip
         @return:
         """
-        routers = list_routers(self.apiclient, account=self.account.name)
+        routers = list_routers(self.apiclient, account=self.account.name,
+                                listall=True)
         self.assertTrue(len(routers) > 0, msg = "No virtual router found")
         router = routers[0]
 
@@ -181,7 +182,8 @@ class TestDeployVM(cloudstackTestCase):
         2. is in the account the VM was deployed in
         @return:
         """
-        routers = list_routers(self.apiclient, account=self.account.name)
+        routers = list_routers(self.apiclient, account=self.account.name,
+                                listall=True)
         self.assertTrue(len(routers) > 0, msg = "No virtual router found")
         router = routers[0]
 

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/ee9613b6/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
deleted file mode 100644
index 5a3d8aa..0000000
--- a/tools/marvin/marvin/config/test_data.cfg
+++ /dev/null
@@ -1,427 +0,0 @@
-# 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.
-
-{
-        "region": {
-                "regionid": "2",
-                "regionname": "Region2",
-                "regionendpoint": "http://region2:8080/client"
-        },
-        "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"
-        }, 
-        "small": {
-            "displayname": "testserver",
-            "username": "root", 
-            "password": "password",
-            "ssh_port": 22,
-            "hypervisor": "XenServer",
-            "privateport": 22,
-            "publicport": 22,
-            "protocol": 'TCP',
-        },
-        "medium": {
-            "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, 
-                "memory": 128, 
-            },   
-            "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  
-        },
-        '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"
-            }
-        },
-        "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",
-            "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,
-            "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"
-        },
-        "clusters": {
-            0: {
-                "clustername": "Xen Cluster",
-                "clustertype": "CloudManaged",
-                "hypervisor": "XenServer",
-            },
-            1: {
-                "clustername": "KVM Cluster",
-                "clustertype": "CloudManaged",
-                "hypervisor": "KVM",
-            },
-            2: {
-                "hypervisor": 'VMware',
-                "clustertype": 'ExternalManaged',
-                "username": 'administrator',
-                "password": 'fr3sca',
-                "url": 'http://192.168.100.17/CloudStack-Clogeny-Pune/Pune-1',
-                "clustername": 'VMWare Cluster',
-            },
-        },
-        "hosts": {
-            "xenserver": {
-                "hypervisor": 'XenServer',
-                "clustertype": 'CloudManaged',
-                "url": 'http://192.168.100.211',
-                "username": "root",
-                "password": "fr3sca",
-            },
-            "kvm": {
-                "hypervisor": 'KVM',
-                "clustertype": 'CloudManaged',
-                "url": 'http://192.168.100.212',
-                "username": "root",
-                "password": "fr3sca",
-            },
-            "vmware": {
-                "hypervisor": 'VMware',
-                "clustertype": '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",
-            "privateport": 22,
-            "publicport": 2222,
-            "protocol": 'TCP'
-        },
-
-        "iso1": {
-            "displaytext": "Test ISO 1",
-            "name": "ISO 1",
-            "url": "http://people.apache.org/~tsp/dummy.iso",
-            "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",
-            "isextractable": True,
-            "isfeatured": True,
-            "ispublic": True,
-            "ostype": "CentOS 5.3 (64-bit)",
-            "mode": 'HTTP_DOWNLOAD',
-        },
-        "isfeatured": True,
-        "ispublic": True,
-        "isextractable": True,
-        "bootable": True, 
-        "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"
-        },
-        "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"
-        },
-        "vlan": {
-            "part": ["4090-4091", "4092-4095"],
-            "full": "4090-4095",
-        },
-        "nfs": {
-            "url": "nfs://10.147.28.7/export/home/talluri/testprimary",
-            "name": "Primary XEN"
-        },
-        "iscsi": {
-            "url": "iscsi://192.168.100.21/iqn.2012-01.localdomain.clo-cstack-cos6:iser/1",
-            "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"
-        }
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/ee9613b6/tools/marvin/marvin/config/test_data.py
----------------------------------------------------------------------
diff --git a/tools/marvin/marvin/config/test_data.py b/tools/marvin/marvin/config/test_data.py
index 2b820d6..b89e6f9 100644
--- a/tools/marvin/marvin/config/test_data.py
+++ b/tools/marvin/marvin/config/test_data.py
@@ -27,6 +27,7 @@ test_data = {
     "vdomain": {
             "name": "domain"
     },
+    "domain": { "name": "domain" },
     "email": "test@test.com",
     "gateway": "172.1.1.1",
     "netmask": "255.255.255.0",

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/ee9613b6/tools/marvin/marvin/lib/base.py
----------------------------------------------------------------------
diff --git a/tools/marvin/marvin/lib/base.py b/tools/marvin/marvin/lib/base.py
index d2dc1a3..7632572 100644
--- a/tools/marvin/marvin/lib/base.py
+++ b/tools/marvin/marvin/lib/base.py
@@ -352,7 +352,7 @@ class VirtualMachine:
                projectid=None, startvm=None, diskofferingid=None,
                affinitygroupnames=None, affinitygroupids=None, group=None,
                hostid=None, keypair=None, ipaddress=None, mode='default',
-               method='GET', hypervisor=None, customcpunumber=None,
+               method='GET', hypervisor="XenServer", customcpunumber=None,
                customcpuspeed=None, custommemory=None, rootdisksize=None):
         """Create the instance"""
 

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/ee9613b6/tools/marvin/marvin/lib/utils.py
----------------------------------------------------------------------
diff --git a/tools/marvin/marvin/lib/utils.py b/tools/marvin/marvin/lib/utils.py
index 5178f5d..4194e32 100644
--- a/tools/marvin/marvin/lib/utils.py
+++ b/tools/marvin/marvin/lib/utils.py
@@ -366,7 +366,7 @@ def is_snapshot_on_nfs(apiclient, dbconn, config, zoneid, snapshotid):
         )
         cmds = [
             "mkdir -p %s /mnt/tmp",
-            "mount -t %s %s%s /mnt/tmp" % (
+            "mount -t %s %s:%s /mnt/tmp" % (
                 'nfs',
                 host,
                 path,


[2/3] git commit: updated refs/heads/4.4 to ee9613b

Posted by da...@apache.org.
CLOUDSTACK-5674:Fixed pep8 errors in python files in marvin folder
Signed-off-by: SrikanteswaraRao Talluri <ta...@apache.org>

(cherry picked from commit 4f1f182cba5579da2fc7ce1f02019a0afa00efeb)

Conflicts:
	tools/marvin/marvin/lib/base.py


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

Branch: refs/heads/4.4
Commit: 4a99cf851966512ae90633b7ed7d7954b6d0ac9a
Parents: e33d4a5
Author: SrikanteswaraRao Talluri <ta...@apache.org>
Authored: Mon Apr 28 17:54:15 2014 +0530
Committer: Daan Hoogland <da...@onecht.net>
Committed: Mon Jul 28 23:10:31 2014 +0200

----------------------------------------------------------------------
 tools/marvin/marvin/cloudstackConnection.py |   2 +-
 tools/marvin/marvin/codegenerator.py        |  19 +-
 tools/marvin/marvin/codes.py                |   4 +-
 tools/marvin/marvin/configGenerator.py      |  10 +-
 tools/marvin/marvin/deployAndRun.py         |   4 +-
 tools/marvin/marvin/lib/__init__.py         |   4 +-
 tools/marvin/marvin/lib/base.py             | 504 +++++++++++++++--------
 tools/marvin/marvin/lib/common.py           | 176 +++++---
 tools/marvin/marvin/lib/utils.py            | 206 +++++----
 tools/marvin/marvin/marvinInit.py           |  13 +-
 tools/marvin/marvin/marvinPlugin.py         |   2 +-
 tools/marvin/marvin/sshClient.py            |   6 +-
 12 files changed, 594 insertions(+), 356 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/4a99cf85/tools/marvin/marvin/cloudstackConnection.py
----------------------------------------------------------------------
diff --git a/tools/marvin/marvin/cloudstackConnection.py b/tools/marvin/marvin/cloudstackConnection.py
index d006002..caa8609 100644
--- a/tools/marvin/marvin/cloudstackConnection.py
+++ b/tools/marvin/marvin/cloudstackConnection.py
@@ -149,7 +149,7 @@ class CSConnection(object):
                 [str.lower(r[0]),
                  str.lower(
                      urllib.quote_plus(str(r[1]))
-                 ).replace("+", "%20")]
+                ).replace("+", "%20")]
             ) for r in params]
         )
         signature = base64.encodestring(hmac.new(

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/4a99cf85/tools/marvin/marvin/codegenerator.py
----------------------------------------------------------------------
diff --git a/tools/marvin/marvin/codegenerator.py b/tools/marvin/marvin/codegenerator.py
index 1e02ddf..e5015c6 100644
--- a/tools/marvin/marvin/codegenerator.py
+++ b/tools/marvin/marvin/codegenerator.py
@@ -343,7 +343,7 @@ class CodeGenerator(object):
             paramProperty.desc = response['description']
         if 'type' in response:
             if response['type'] in ['list', 'map', 'set']:
-            # Here list becomes a subproperty
+                # Here list becomes a subproperty
                 if 'response' in response:
                     for innerResponse in response['response']:
                         subProperty =\
@@ -359,9 +359,9 @@ class CodeGenerator(object):
         jsonOut = apiStream.readlines()
         assert len(jsonOut) > 0
         apiDict = json.loads(jsonOut[0])
-        if not 'listapisresponse' in apiDict:
+        if 'listapisresponse' not in apiDict:
             raise Exception("API discovery plugin response failed")
-        if not 'count' in apiDict['listapisresponse']:
+        if 'count' not in apiDict['listapisresponse']:
             raise Exception("Malformed api response")
 
         apilist = apiDict['listapisresponse']['api']
@@ -397,7 +397,8 @@ class CodeGenerator(object):
                 csCmd.request.append(paramProperty)
 
             for response in cmd['response']:
-            # FIXME: ExtractImage related APIs return empty dicts in response
+                # FIXME: ExtractImage related APIs return empty dicts in
+                # response
                 if len(response) > 0:
                     paramProperty = self.constructResponseFromJSON(response)
                     csCmd.response.append(paramProperty)
@@ -412,11 +413,11 @@ class CodeGenerator(object):
         @return: The classes in cloudstackAPI/ formed from api discovery json
         """
         if endpointUrl.find('response=json') >= 0:
-                apiStream = urllib2.urlopen(endpointUrl)
-                cmds = self.loadCmdFromJSON(apiStream)
-                for cmd in cmds:
-                    self.generate(cmd)
-                self.finalize()
+            apiStream = urllib2.urlopen(endpointUrl)
+            cmds = self.loadCmdFromJSON(apiStream)
+            for cmd in cmds:
+                self.generate(cmd)
+            self.finalize()
 
 
 def getText(elements):

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/4a99cf85/tools/marvin/marvin/codes.py
----------------------------------------------------------------------
diff --git a/tools/marvin/marvin/codes.py b/tools/marvin/marvin/codes.py
index 98299fa..ef49c0c 100644
--- a/tools/marvin/marvin/codes.py
+++ b/tools/marvin/marvin/codes.py
@@ -79,5 +79,5 @@ ADMIN = 1
 DOMAIN_ADMIN = 2
 USER = 0
 XEN_SERVER = "XenServer"
-ADMIN_ACCOUNT='ADMIN_ACCOUNT'
-USER_ACCOUNT='USER_ACCOUNT'
+ADMIN_ACCOUNT = 'ADMIN_ACCOUNT'
+USER_ACCOUNT = 'USER_ACCOUNT'

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/4a99cf85/tools/marvin/marvin/configGenerator.py
----------------------------------------------------------------------
diff --git a/tools/marvin/marvin/configGenerator.py b/tools/marvin/marvin/configGenerator.py
index bc77153..8556274 100644
--- a/tools/marvin/marvin/configGenerator.py
+++ b/tools/marvin/marvin/configGenerator.py
@@ -47,17 +47,20 @@ class dbServer(object):
 
 
 class configuration(object):
+
     def __init__(self):
         self.name = None
         self.value = None
 
 
 class logger(object):
+
     def __init__(self):
         self.LogFolderPath = None
 
 
 class cloudstackConfiguration(object):
+
     def __init__(self):
         self.zones = []
         self.mgtSvr = []
@@ -68,6 +71,7 @@ class cloudstackConfiguration(object):
 
 
 class zone(object):
+
     def __init__(self):
         self.dns1 = None
         self.internaldns1 = None
@@ -846,8 +850,8 @@ def descSetupInAdvancedsgMode():
                     memory = 8 * 1024 * 1024 * 1024
                     localstorage = 1 * 1024 * 1024 * 1024 * 1024
                     # h.url = "http://sim/%d%d%d%d/cpucore=1&cpuspeed=8000&\
-                        # memory=%d&localstorage=%d" % (l, i, j, k, memory,
-                        # localstorage)
+                    # memory=%d&localstorage=%d" % (l, i, j, k, memory,
+                    # localstorage)
                     h.url = "http://sim/%d%d%d%d" % (l, i, j, k)
                     c.hosts.append(h)
 
@@ -856,8 +860,6 @@ def descSetupInAdvancedsgMode():
                     primary = primaryStorage()
                     primary.name = "primary" + \
                         str(l) + str(i) + str(j) + str(m)
-                    # primary.url = "nfs://localhost/path%s/size=%d" % \
-                        #(str(l) + str(i) + str(j) + str(m), size)
                     primary.url = "nfs://localhost/path%s" % \
                         (str(l) + str(i) + str(j) + str(m))
                     c.primaryStorages.append(primary)

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/4a99cf85/tools/marvin/marvin/deployAndRun.py
----------------------------------------------------------------------
diff --git a/tools/marvin/marvin/deployAndRun.py b/tools/marvin/marvin/deployAndRun.py
index d3b6b86..9f392e5 100644
--- a/tools/marvin/marvin/deployAndRun.py
+++ b/tools/marvin/marvin/deployAndRun.py
@@ -97,8 +97,8 @@ def startMarvin(cfg_file, load_flag):
             print "\nMarvin Initialization Failed"
             exit(1)
     except Exception as e:
-            print "\n Exception occurred while starting Marvin %s" % str(e)
-            exit(1)
+        print "\n Exception occurred while starting Marvin %s" % str(e)
+        exit(1)
 
 
 def runTCs(num_iter, inp1, inp2):

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/4a99cf85/tools/marvin/marvin/lib/__init__.py
----------------------------------------------------------------------
diff --git a/tools/marvin/marvin/lib/__init__.py b/tools/marvin/marvin/lib/__init__.py
index 978b68a..13a8339 100644
--- a/tools/marvin/marvin/lib/__init__.py
+++ b/tools/marvin/marvin/lib/__init__.py
@@ -5,9 +5,9 @@
 # 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

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/4a99cf85/tools/marvin/marvin/lib/base.py
----------------------------------------------------------------------
diff --git a/tools/marvin/marvin/lib/base.py b/tools/marvin/marvin/lib/base.py
index 2cd7009..d2dc1a3 100644
--- a/tools/marvin/marvin/lib/base.py
+++ b/tools/marvin/marvin/lib/base.py
@@ -20,13 +20,12 @@
 """
 
 import marvin
-from utils import is_server_ssh_ready, random_gen
 from marvin.cloudstackAPI import *
 from marvin.codes import (FAILED, FAIL, PASS, RUNNING, STOPPED,
                           STARTING, DESTROYED, EXPUNGING,
                           STOPPING)
 from marvin.cloudstackException import GetDetailExceptionInfo
-from marvin.lib.utils import validateList
+from marvin.lib.utils import validateList, is_server_ssh_ready, random_gen
 # Import System modules
 import time
 import hashlib
@@ -34,7 +33,9 @@ import base64
 
 
 class Domain:
+
     """ Domain Life Cycle """
+
     def __init__(self, items):
         self.__dict__.update(items)
 
@@ -86,7 +87,9 @@ class Domain:
 
 
 class Account:
+
     """ Account Life Cycle """
+
     def __init__(self, items):
         self.__dict__.update(items)
 
@@ -104,16 +107,16 @@ class Account:
 
         cmd.password = services["password"]
 
-        username = "-".join([services["username"], random_gen(id=apiclient.id)])
+        username = "-".join([services["username"],
+                             random_gen(id=apiclient.id)])
         #  Trim username to 99 characters to prevent failure
         cmd.username = username[:99] if len(username) > 99 else username
 
         if "accountUUID" in services:
-            cmd.accountid =  "-".join([services["accountUUID"],random_gen()])
+            cmd.accountid = "-".join([services["accountUUID"], random_gen()])
 
         if "userUUID" in services:
-            cmd.userid = "-".join([services["userUUID"],random_gen()])
-
+            cmd.userid = "-".join([services["userUUID"], random_gen()])
 
         if domainid:
             cmd.domainid = domainid
@@ -145,7 +148,9 @@ class Account:
 
 
 class User:
+
     """ User Life Cycle """
+
     def __init__(self, items):
         self.__dict__.update(items)
 
@@ -161,7 +166,7 @@ class User:
         cmd.lastname = services["lastname"]
 
         if "userUUID" in services:
-            cmd.userid = "-".join([services["userUUID"],random_gen()])
+            cmd.userid = "-".join([services["userUUID"], random_gen()])
 
         cmd.password = services["password"]
         cmd.username = "-".join([services["username"], random_gen()])
@@ -222,6 +227,7 @@ class User:
 
 
 class VirtualMachine:
+
     """Manage virtual machine lifecycle"""
 
     '''Class level variables'''
@@ -255,7 +261,8 @@ class VirtualMachine:
     @classmethod
     def ssh_access_group(cls, apiclient, cmd):
         """
-        Programs the security group with SSH access before deploying virtualmachine
+        Programs the security group with SSH
+         access before deploying virtualmachine
         @return:
         """
         zone_list = Zone.list(
@@ -264,7 +271,7 @@ class VirtualMachine:
             domainid=cmd.domainid if cmd.domainid else None
         )
         zone = zone_list[0]
-        #check if security groups settings is enabled for the zone
+        # check if security groups settings is enabled for the zone
         if zone.securitygroupsenabled:
             list_security_groups = SecurityGroup.list(
                 apiclient,
@@ -287,9 +294,11 @@ class VirtualMachine:
                     "endport": 22,
                     "cidrlist": "0.0.0.0/0"
                 }
-                #Authorize security group for above ingress rule
-                basic_mode_security_group.authorize(apiclient, sec_grp_services, account=cmd.account,
-                    domainid=cmd.domainid)
+                # Authorize security group for above ingress rule
+                basic_mode_security_group.authorize(apiclient,
+                                                    sec_grp_services,
+                                                    account=cmd.account,
+                                                    domainid=cmd.domainid)
             else:
                 basic_mode_security_group = list_security_groups[0]
 
@@ -299,7 +308,8 @@ class VirtualMachine:
                 cmd.securitygroupids = [basic_mode_security_group.id]
 
     @classmethod
-    def access_ssh_over_nat(cls, apiclient, services, virtual_machine, allow_egress=False):
+    def access_ssh_over_nat(
+            cls, apiclient, services, virtual_machine, allow_egress=False):
         """
         Program NAT and PF rules to open up ssh access to deployed guest
         @return:
@@ -337,11 +347,13 @@ class VirtualMachine:
 
     @classmethod
     def create(cls, apiclient, services, templateid=None, accountid=None,
-                    domainid=None, zoneid=None, networkids=None, serviceofferingid=None,
-                    securitygroupids=None, projectid=None, startvm=None,
-                    diskofferingid=None, affinitygroupnames=None, affinitygroupids=None, group=None,
-                    hostid=None, keypair=None, ipaddress=None, mode='default', method='GET',hypervisor=None,
-                    customcpunumber=None, customcpuspeed=None, custommemory=None, rootdisksize=None):
+               domainid=None, zoneid=None, networkids=None,
+               serviceofferingid=None, securitygroupids=None,
+               projectid=None, startvm=None, diskofferingid=None,
+               affinitygroupnames=None, affinitygroupids=None, group=None,
+               hostid=None, keypair=None, ipaddress=None, mode='default',
+               method='GET', hypervisor=None, customcpunumber=None,
+               customcpuspeed=None, custommemory=None, rootdisksize=None):
         """Create the instance"""
 
         cmd = deployVirtualMachine.deployVirtualMachineCmd()
@@ -410,12 +422,12 @@ class VirtualMachine:
             cmd.securitygroupids = [str(sg_id) for sg_id in securitygroupids]
 
         if "affinitygroupnames" in services:
-            cmd.affinitygroupnames  = services["affinitygroupnames"]
+            cmd.affinitygroupnames = services["affinitygroupnames"]
         elif affinitygroupnames:
-            cmd.affinitygroupnames  = affinitygroupnames
+            cmd.affinitygroupnames = affinitygroupnames
 
         if affinitygroupids:
-            cmd.affinitygroupids  = affinitygroupids
+            cmd.affinitygroupids = affinitygroupids
 
         if projectid:
             cmd.projectid = projectid
@@ -446,25 +458,31 @@ class VirtualMachine:
         if group:
             cmd.group = group
 
-        #program default access to ssh
+        # program default access to ssh
         if mode.lower() == 'basic':
             cls.ssh_access_group(apiclient, cmd)
 
         virtual_machine = apiclient.deployVirtualMachine(cmd, method=method)
 
         virtual_machine.ssh_ip = virtual_machine.nic[0].ipaddress
-        if startvm == False:
+        if startvm is False:
             virtual_machine.public_ip = virtual_machine.nic[0].ipaddress
             return VirtualMachine(virtual_machine.__dict__, services)
 
-        #program ssh access over NAT via PF
+        # program ssh access over NAT via PF
         if mode.lower() == 'advanced':
-            cls.access_ssh_over_nat(apiclient, services, virtual_machine, allow_egress=allow_egress)
+            cls.access_ssh_over_nat(
+                apiclient,
+                services,
+                virtual_machine,
+                allow_egress=allow_egress)
         elif mode.lower() == 'basic':
             if virtual_machine.publicip is not None:
-                vm_ssh_ip = virtual_machine.publicip #EIP/ELB (netscaler) enabled zone
+                # EIP/ELB (netscaler) enabled zone
+                vm_ssh_ip = virtual_machine.publicip
             else:
-                vm_ssh_ip = virtual_machine.nic[0].ipaddress #regular basic zone with security group
+                # regular basic zone with security group
+                vm_ssh_ip = virtual_machine.nic[0].ipaddress
             virtual_machine.ssh_ip = vm_ssh_ip
             virtual_machine.public_ip = vm_ssh_ip
 
@@ -512,12 +530,14 @@ class VirtualMachine:
             cmd.templateid = templateid
         return apiclient.restoreVirtualMachine(cmd)
 
-    def get_ssh_client(self, ipaddress=None, reconnect=False, port=None, keyPairFileLocation=None):
+    def get_ssh_client(
+            self, ipaddress=None, reconnect=False, port=None,
+            keyPairFileLocation=None):
         """Get SSH object of VM"""
 
         # If NAT Rules are not created while VM deployment in Advanced mode
         # then, IP address must be passed
-        if ipaddress != None:
+        if ipaddress is not None:
             self.ssh_ip = ipaddress
         if port:
             self.ssh_port = port
@@ -527,19 +547,19 @@ class VirtualMachine:
 
         if reconnect:
             self.ssh_client = is_server_ssh_ready(
-                                                    self.ssh_ip,
-                                                    self.ssh_port,
-                                                    self.username,
-                                                    self.password,
-                                                    keyPairFileLocation=keyPairFileLocation
-                                                )
+                self.ssh_ip,
+                self.ssh_port,
+                self.username,
+                self.password,
+                keyPairFileLocation=keyPairFileLocation
+            )
         self.ssh_client = self.ssh_client or is_server_ssh_ready(
-                                                    self.ssh_ip,
-                                                    self.ssh_port,
-                                                    self.username,
-                                                    self.password,
-                                                    keyPairFileLocation=keyPairFileLocation
-                                                )
+            self.ssh_ip,
+            self.ssh_port,
+            self.username,
+            self.password,
+            keyPairFileLocation=keyPairFileLocation
+        )
         return self.ssh_client
 
     def getState(self, apiclient, state, timeout=600):
@@ -636,7 +656,8 @@ class VirtualMachine:
 
     def update_default_nic(self, apiclient, nicId):
         """Set a NIC to be the default network adapter for a VM"""
-        cmd = updateDefaultNicForVirtualMachine.updateDefaultNicForVirtualMachineCmd()
+        cmd = updateDefaultNicForVirtualMachine.\
+            updateDefaultNicForVirtualMachineCmd()
         cmd.nicid = nicId
         cmd.virtualmachineid = self.id
         return apiclient.updateDefaultNicForVirtualMachine(cmd)
@@ -653,7 +674,7 @@ class VirtualMachine:
         cmd = detachIso.detachIsoCmd()
         cmd.virtualmachineid = self.id
         return apiclient.detachIso(cmd)
-    
+
     def scale_virtualmachine(self, apiclient, serviceOfferingId):
         """ Scale up of service offering for the Instance"""
         cmd = scaleVirtualMachine.scaleVirtualMachineCmd()
@@ -663,7 +684,8 @@ class VirtualMachine:
 
     def change_service_offering(self, apiclient, serviceOfferingId):
         """Change service offering of the instance"""
-        cmd = changeServiceForVirtualMachine.changeServiceForVirtualMachineCmd()
+        cmd = changeServiceForVirtualMachine.\
+            changeServiceForVirtualMachineCmd()
         cmd.id = self.id
         cmd.serviceofferingid = serviceOfferingId
         return apiclient.changeServiceForVirtualMachine(cmd)
@@ -679,7 +701,8 @@ class VirtualMachine:
     def resetPassword(self, apiclient):
         """Resets VM password if VM created using password enabled template"""
 
-        cmd = resetPasswordForVirtualMachine.resetPasswordForVirtualMachineCmd()
+        cmd = resetPasswordForVirtualMachine.\
+            resetPasswordForVirtualMachineCmd()
         cmd.id = self.id
         try:
             response = apiclient.resetPasswordForVirtualMachine(cmd)
@@ -691,15 +714,15 @@ class VirtualMachine:
     def assign_virtual_machine(self, apiclient, account, domainid):
         """Move a user VM to another user under same domain."""
 
-        cmd                  = assignVirtualMachine.assignVirtualMachineCmd()
+        cmd = assignVirtualMachine.assignVirtualMachineCmd()
         cmd.virtualmachineid = self.id
-        cmd.account          = account
-        cmd.domainid         = domainid
+        cmd.account = account
+        cmd.domainid = domainid
         try:
             response = apiclient.assignVirtualMachine(cmd)
             return response
         except Exception as e:
-            raise Exception("assignVirtualMachine failed - %s" %e)
+            raise Exception("assignVirtualMachine failed - %s" % e)
 
     def update_affinity_group(self, apiclient, affinitygroupids=None,
                               affinitygroupnames=None):
@@ -716,12 +739,12 @@ class VirtualMachine:
         return apiclient.updateVMAffinityGroup(cmd)
 
     def scale(self, apiclient, serviceOfferingId,
-            customcpunumber=None, customcpuspeed=None, custommemory=None):
+              customcpunumber=None, customcpuspeed=None, custommemory=None):
         """Change service offering of the instance"""
         cmd = scaleVirtualMachine.scaleVirtualMachineCmd()
         cmd.id = self.id
         cmd.serviceofferingid = serviceOfferingId
-        cmd.details = [{"cpuNumber": "","cpuSpeed":"","memory":""}]
+        cmd.details = [{"cpuNumber": "", "cpuSpeed": "", "memory": ""}]
         if customcpunumber:
             cmd.details[0]["cpuNumber"] = customcpunumber
         if customcpuspeed:
@@ -732,8 +755,10 @@ class VirtualMachine:
 
 
 class Volume:
+
     """Manage Volume Life cycle
     """
+
     def __init__(self, items):
         self.__dict__.update(items)
 
@@ -770,7 +795,7 @@ class Volume:
 
     @classmethod
     def create_custom_disk(cls, apiclient, services, account=None,
-                                    domainid=None, diskofferingid=None):
+                           domainid=None, diskofferingid=None):
         """Create Volume from Custom disk offering"""
         cmd = createVolume.createVolumeCmd()
         cmd.name = services["diskname"]
@@ -836,7 +861,8 @@ class Volume:
         return(apiclient.resizeVolume(cmd))
 
     @classmethod
-    def upload(cls, apiclient, services, zoneid=None, account=None, domainid=None, url=None):
+    def upload(cls, apiclient, services, zoneid=None,
+               account=None, domainid=None, url=None):
         """Uploads the volume to specified account"""
 
         cmd = uploadVolume.uploadVolumeCmd()
@@ -861,10 +887,10 @@ class Volume:
 
         while True:
             volume_response = Volume.list(
-                                    apiclient,
-                                    id=self.id,
-                                    zoneid=self.zoneid,
-                                    )
+                apiclient,
+                id=self.id,
+                zoneid=self.zoneid,
+            )
             if isinstance(volume_response, list):
 
                 volume = volume_response[0]
@@ -879,7 +905,7 @@ class Volume:
                 elif 'Installing' not in volume.state:
                     raise Exception(
                         "Error in uploading volume: status - %s" %
-                                                            volume.state)
+                        volume.state)
             elif timeout == 0:
                 break
 
@@ -891,7 +917,7 @@ class Volume:
     @classmethod
     def extract(cls, apiclient, volume_id, zoneid, mode):
         """Extracts the volume"""
-        
+
         cmd = extractVolume.extractVolumeCmd()
         cmd.id = volume_id
         cmd.zoneid = zoneid
@@ -905,15 +931,18 @@ class Volume:
         [setattr(cmd, k, v) for k, v in kwargs.items()]
         return(apiclient.migrateVolume(cmd))
 
+
 class Snapshot:
+
     """Manage Snapshot Lifecycle
     """
+
     def __init__(self, items):
         self.__dict__.update(items)
 
     @classmethod
     def create(cls, apiclient, volume_id, account=None,
-                                            domainid=None, projectid=None):
+               domainid=None, projectid=None):
         """Create Snapshot"""
         cmd = createSnapshot.createSnapshotCmd()
         cmd.volumeid = volume_id
@@ -941,6 +970,7 @@ class Snapshot:
 
 
 class Template:
+
     """Manage template life cycle"""
 
     def __init__(self, items):
@@ -965,16 +995,20 @@ class Template:
             if not isinstance(ostypes, list):
                 raise Exception(
                     "Unable to find Ostype id with desc: %s" %
-                                                services["ostype"])
+                    services["ostype"])
             cmd.ostypeid = ostypes[0].id
         else:
             raise Exception(
-                    "Unable to find Ostype is required for creating template")
+                "Unable to find Ostype is required for creating template")
 
-        cmd.isfeatured = services["isfeatured"] if "isfeatured" in services else False
-        cmd.ispublic = services["ispublic"] if "ispublic" in services else False
-        cmd.isextractable = services["isextractable"] if "isextractable" in services else False
-        cmd.passwordenabled = services["passwordenabled"] if "passwordenabled" in services else False
+        cmd.isfeatured = services[
+            "isfeatured"] if "isfeatured" in services else False
+        cmd.ispublic = services[
+            "ispublic"] if "ispublic" in services else False
+        cmd.isextractable = services[
+            "isextractable"] if "isextractable" in services else False
+        cmd.passwordenabled = services[
+            "passwordenabled"] if "passwordenabled" in services else False
 
         if volumeid:
             cmd.volumeid = volumeid
@@ -991,7 +1025,7 @@ class Template:
 
     @classmethod
     def register(cls, apiclient, services, zoneid=None,
-                                                account=None, domainid=None, hypervisor=None):
+                 account=None, domainid=None, hypervisor=None):
         """Create template from URL"""
 
         # Create template from Virtual machine and Volume ID
@@ -999,7 +1033,7 @@ class Template:
         cmd.displaytext = services["displaytext"]
         cmd.name = "-".join([services["name"], random_gen()])
         cmd.format = services["format"]
-        cmd.hypervisor = hypervisor 
+        cmd.hypervisor = hypervisor
 
         if "ostypeid" in services:
             cmd.ostypeid = services["ostypeid"]
@@ -1012,11 +1046,11 @@ class Template:
             if not isinstance(ostypes, list):
                 raise Exception(
                     "Unable to find Ostype id with desc: %s" %
-                                                services["ostype"])
+                    services["ostype"])
             cmd.ostypeid = ostypes[0].id
         else:
             raise Exception(
-                    "Unable to find Ostype is required for registering template")
+                "Unable to find Ostype is required for registering template")
 
         cmd.url = services["url"]
 
@@ -1025,10 +1059,14 @@ class Template:
         else:
             cmd.zoneid = services["zoneid"]
 
-        cmd.isfeatured = services["isfeatured"] if "isfeatured" in services else False
-        cmd.ispublic = services["ispublic"] if "ispublic" in services else False
-        cmd.isextractable = services["isextractable"] if "isextractable" in services else False
-        cmd.passwordenabled = services["passwordenabled"] if "passwordenabled" in services else False
+        cmd.isfeatured = services[
+            "isfeatured"] if "isfeatured" in services else False
+        cmd.ispublic = services[
+            "ispublic"] if "ispublic" in services else False
+        cmd.isextractable = services[
+            "isextractable"] if "isextractable" in services else False
+        cmd.passwordenabled = services[
+            "passwordenabled"] if "passwordenabled" in services else False
 
         if account:
             cmd.account = account
@@ -1055,15 +1093,15 @@ class Template:
 
     @classmethod
     def create_from_snapshot(cls, apiclient, snapshot, services,
-                                                        random_name=True):
+                             random_name=True):
         """Create Template from snapshot"""
         # Create template from Virtual machine and Snapshot ID
         cmd = createTemplate.createTemplateCmd()
         cmd.displaytext = services["displaytext"]
         cmd.name = "-".join([
-                             services["name"],
-                             random_gen()
-                            ]) if random_name else services["name"]
+            services["name"],
+            random_gen()
+        ]) if random_name else services["name"]
 
         if "ostypeid" in services:
             cmd.ostypeid = services["ostypeid"]
@@ -1076,11 +1114,11 @@ class Template:
             if not isinstance(ostypes, list):
                 raise Exception(
                     "Unable to find Ostype id with desc: %s" %
-                                                services["ostype"])
+                    services["ostype"])
             cmd.ostypeid = ostypes[0].id
         else:
             raise Exception(
-                    "Unable to find Ostype is required for creating template")
+                "Unable to find Ostype is required for creating template")
 
         cmd.snapshotid = snapshot.id
         return Template(apiclient.createTemplate(cmd).__dict__)
@@ -1099,11 +1137,11 @@ class Template:
 
         while True:
             template_response = Template.list(
-                                    apiclient,
-                                    id=self.id,
-                                    zoneid=self.zoneid,
-                                    templatefilter='self'
-                                    )
+                apiclient,
+                id=self.id,
+                zoneid=self.zoneid,
+                templatefilter='self'
+            )
             if isinstance(template_response, list):
 
                 template = template_response[0]
@@ -1120,7 +1158,7 @@ class Template:
                 elif 'Installing' not in template.status:
                     raise Exception(
                         "Error in downloading template: status - %s" %
-                                                            template.status)
+                        template.status)
 
             elif timeout == 0:
                 break
@@ -1167,6 +1205,7 @@ class Template:
 
 
 class Iso:
+
     """Manage ISO life cycle"""
 
     def __init__(self, items):
@@ -1174,7 +1213,7 @@ class Iso:
 
     @classmethod
     def create(cls, apiclient, services, account=None, domainid=None,
-                                                        projectid=None):
+               projectid=None):
         """Create an ISO"""
         # Create ISO from URL
         cmd = registerIso.registerIsoCmd()
@@ -1191,11 +1230,11 @@ class Iso:
             if not isinstance(ostypes, list):
                 raise Exception(
                     "Unable to find Ostype id with desc: %s" %
-                                                services["ostype"])
+                    services["ostype"])
             cmd.ostypeid = ostypes[0].id
         else:
             raise Exception(
-                    "Unable to find Ostype is required for creating ISO")
+                "Unable to find Ostype is required for creating ISO")
 
         cmd.url = services["url"]
         cmd.zoneid = services["zoneid"]
@@ -1245,10 +1284,10 @@ class Iso:
                 if response.status == 'Successfully Installed':
                     return
                 elif 'Downloaded' not in response.status and \
-                    'Installing' not in response.status:
+                        'Installing' not in response.status:
                     raise Exception(
                         "Error In Downloading ISO: ISO Status - %s" %
-                                                            response.status)
+                        response.status)
 
             elif timeout == 0:
                 raise Exception("ISO download Timeout Exception")
@@ -1296,14 +1335,16 @@ class Iso:
 
 
 class PublicIPAddress:
+
     """Manage Public IP Addresses"""
 
     def __init__(self, items):
         self.__dict__.update(items)
 
     @classmethod
-    def create(cls, apiclient, accountid=None, zoneid=None, domainid=None, services=None,
-               networkid=None, projectid=None, vpcid=None, isportable=False):
+    def create(cls, apiclient, accountid=None, zoneid=None, domainid=None,
+               services=None, networkid=None, projectid=None, vpcid=None,
+               isportable=False):
         """Associate Public IP address"""
         cmd = associateIpAddress.associateIpAddressCmd()
 
@@ -1352,6 +1393,7 @@ class PublicIPAddress:
 
 
 class NATRule:
+
     """Manage port forwarding rule"""
 
     def __init__(self, items):
@@ -1412,13 +1454,15 @@ class NATRule:
 
 
 class StaticNATRule:
+
     """Manage Static NAT rule"""
 
     def __init__(self, items):
         self.__dict__.update(items)
 
     @classmethod
-    def create(cls, apiclient, services, ipaddressid=None, networkid=None, vpcid=None):
+    def create(cls, apiclient, services, ipaddressid=None,
+               networkid=None, vpcid=None):
         """Creates static ip forwarding rule"""
 
         cmd = createFirewallRule.createFirewallRuleCmd()
@@ -1460,7 +1504,7 @@ class StaticNATRule:
 
     @classmethod
     def enable(cls, apiclient, ipaddressid, virtualmachineid, networkid=None,
-            vmguestip=None):
+               vmguestip=None):
         """Enables Static NAT rule"""
 
         cmd = enableStaticNat.enableStaticNatCmd()
@@ -1485,6 +1529,7 @@ class StaticNATRule:
 
 
 class EgressFireWallRule:
+
     """Manage Egress Firewall rule"""
 
     def __init__(self, items):
@@ -1504,7 +1549,8 @@ class EgressFireWallRule:
         if endport:
             cmd.endport = endport
 
-        return EgressFireWallRule(apiclient.createEgressFirewallRule(cmd).__dict__)
+        return EgressFireWallRule(
+            apiclient.createEgressFirewallRule(cmd).__dict__)
 
     def delete(self, apiclient):
         """Delete Egress Firewall rule"""
@@ -1522,8 +1568,8 @@ class EgressFireWallRule:
         return(apiclient.listEgressFirewallRules(cmd))
 
 
-
 class FireWallRule:
+
     """Manage Firewall rule"""
 
     def __init__(self, items):
@@ -1568,6 +1614,7 @@ class FireWallRule:
 
 
 class ServiceOffering:
+
     """Manage service offerings cycle"""
 
     def __init__(self, items):
@@ -1601,7 +1648,8 @@ class ServiceOffering:
             cmd.deploymentplanner = services["deploymentplanner"]
 
         if "serviceofferingdetails" in services:
-            cmd.serviceofferingdetails.append({services['serviceofferingdetails']})
+            cmd.serviceofferingdetails.append(
+                {services['serviceofferingdetails']})
 
         if "isvolatile" in services:
             cmd.isvolatile = services["isvolatile"]
@@ -1633,6 +1681,7 @@ class ServiceOffering:
 
 
 class DiskOffering:
+
     """Manage disk offerings cycle"""
 
     def __init__(self, items):
@@ -1674,6 +1723,7 @@ class DiskOffering:
 
 
 class NetworkOffering:
+
     """Manage network offerings cycle"""
 
     def __init__(self, items):
@@ -1698,18 +1748,19 @@ class NetworkOffering:
         if "serviceProviderList" in services:
             for service, provider in services["serviceProviderList"].items():
                 cmd.serviceproviderlist.append({
-                                            'service': service,
-                                            'provider': provider
-                                           })
+                    'service': service,
+                    'provider': provider
+                })
         if "serviceCapabilityList" in services:
             cmd.servicecapabilitylist = []
-            for service, capability in services["serviceCapabilityList"].items():
+            for service, capability in services["serviceCapabilityList"].\
+                                       items():
                 for ctype, value in capability.items():
                     cmd.servicecapabilitylist.append({
-                                            'service': service,
-                                            'capabilitytype': ctype,
-                                            'capabilityvalue': value
-                                           })
+                        'service': service,
+                        'capabilitytype': ctype,
+                        'capabilityvalue': value
+                    })
         if "specifyVlan" in services:
             cmd.specifyVlan = services["specifyVlan"]
         if "specifyIpRanges" in services:
@@ -1750,6 +1801,7 @@ class NetworkOffering:
 
 
 class SnapshotPolicy:
+
     """Manage snapshot policies"""
 
     def __init__(self, items):
@@ -1781,7 +1833,9 @@ class SnapshotPolicy:
         [setattr(cmd, k, v) for k, v in kwargs.items()]
         return(apiclient.listSnapshotPolicies(cmd))
 
+
 class Hypervisor:
+
     """Manage Hypervisor"""
 
     def __init__(self, items):
@@ -1797,6 +1851,7 @@ class Hypervisor:
 
 
 class LoadBalancerRule:
+
     """Manage Load Balancer rule"""
 
     def __init__(self, items):
@@ -1862,7 +1917,8 @@ class LoadBalancerRule:
         apiclient.removeFromLoadBalancerRule(cmd)
         return
 
-    def update(self, apiclient, algorithm=None, description=None, name=None, **kwargs):
+    def update(self, apiclient, algorithm=None,
+               description=None, name=None, **kwargs):
         """Updates the load balancing rule"""
         cmd = updateLoadBalancerRule.updateLoadBalancerRuleCmd()
         cmd.id = self.id
@@ -1876,7 +1932,8 @@ class LoadBalancerRule:
         [setattr(cmd, k, v) for k, v in kwargs.items()]
         return apiclient.updateLoadBalancerRule(cmd)
 
-    def createSticky(self, apiclient, methodname, name, description=None, param=None):
+    def createSticky(
+            self, apiclient, methodname, name, description=None, param=None):
         """Creates a sticky policy for the LB rule"""
 
         cmd = createLBStickinessPolicy.createLBStickinessPolicyCmd()
@@ -1917,13 +1974,15 @@ class LoadBalancerRule:
 
 
 class Cluster:
+
     """Manage Cluster life cycle"""
 
     def __init__(self, items):
         self.__dict__.update(items)
 
     @classmethod
-    def create(cls, apiclient, services, zoneid=None, podid=None, hypervisor=None):
+    def create(cls, apiclient, services, zoneid=None, podid=None,
+               hypervisor=None):
         """Create Cluster"""
         cmd = addCluster.addClusterCmd()
         cmd.clustertype = services["clustertype"]
@@ -1967,13 +2026,15 @@ class Cluster:
 
 
 class Host:
+
     """Manage Host life cycle"""
 
     def __init__(self, items):
         self.__dict__.update(items)
 
     @classmethod
-    def create(cls, apiclient, cluster, services, zoneid=None, podid=None, hypervisor=None):
+    def create(cls, apiclient, cluster, services,
+               zoneid=None, podid=None, hypervisor=None):
         """
         1. Creates the host based upon the information provided.
         2. Verifies the output of the adding host and its state post addition
@@ -2019,12 +2080,14 @@ class Host:
                 while retries:
                     lh_resp = apiclient.listHosts(host[0].id)
                     ret = validateList(lh_resp)
-                    if (ret[0] == PASS) and (str(ret[1].state).lower() == 'up'):
+                    if (ret[0] == PASS) and \
+                            (str(ret[1].state).lower() == 'up'):
                         return Host(host[0].__dict__)
                     retries += -1
             return FAILED
-        except Exception, e:
-            print "Exception Occurred Under Host.create : %s" % GetDetailExceptionInfo(e)
+        except Exception as e:
+            print "Exception Occurred Under Host.create : %s" % \
+                  GetDetailExceptionInfo(e)
             return FAILED
 
     def delete(self, apiclient):
@@ -2096,6 +2159,7 @@ class Host:
 
 
 class StoragePool:
+
     """Manage Storage pools (Primary Storage)"""
 
     def __init__(self, items):
@@ -2103,7 +2167,7 @@ class StoragePool:
 
     @classmethod
     def create(cls, apiclient, services, clusterid=None,
-                                        zoneid=None, podid=None):
+               zoneid=None, podid=None):
         """Create Storage pool (Primary Storage)"""
 
         cmd = createStoragePool.createStoragePoolCmd()
@@ -2163,7 +2227,9 @@ class StoragePool:
         [setattr(cmd, k, v) for k, v in kwargs.items()]
         return(apiclient.findStoragePoolsForMigration(cmd))
 
+
 class Network:
+
     """Manage Network pools"""
 
     def __init__(self, items):
@@ -2255,6 +2321,7 @@ class Network:
 
 
 class NetworkACL:
+
     """Manage Network ACL lifecycle"""
 
     def __init__(self, items):
@@ -2262,7 +2329,8 @@ class NetworkACL:
 
     @classmethod
     def create(cls, apiclient, services, networkid=None, protocol=None,
-               number=None, aclid=None, action='Allow', traffictype=None, cidrlist=[]):
+               number=None, aclid=None, action='Allow',
+               traffictype=None, cidrlist=[]):
         """Create network ACL rules(Ingress/Egress)"""
 
         cmd = createNetworkACL.createNetworkACLCmd()
@@ -2329,13 +2397,15 @@ class NetworkACL:
 
 
 class NetworkACLList:
+
     """Manage Network ACL lists lifecycle"""
 
     def __init__(self, items):
         self.__dict__.update(items)
 
     @classmethod
-    def create(cls, apiclient, services, name=None, description=None, vpcid=None):
+    def create(
+            cls, apiclient, services, name=None, description=None, vpcid=None):
         """Create network ACL container list"""
 
         cmd = createNetworkACLList.createNetworkACLListCmd()
@@ -2373,6 +2443,7 @@ class NetworkACLList:
 
 
 class Vpn:
+
     """Manage VPN life cycle"""
 
     def __init__(self, items):
@@ -2380,7 +2451,7 @@ class Vpn:
 
     @classmethod
     def create(cls, apiclient, publicipid, account=None, domainid=None,
-                        projectid=None, networkid=None, vpcid=None):
+               projectid=None, networkid=None, vpcid=None):
         """Create VPN for Public IP address"""
         cmd = createRemoteAccessVpn.createRemoteAccessVpnCmd()
         cmd.publicipid = publicipid
@@ -2413,6 +2484,7 @@ class Vpn:
 
 
 class VpnUser:
+
     """Manage VPN user"""
 
     def __init__(self, items):
@@ -2457,6 +2529,7 @@ class VpnUser:
 
 
 class Zone:
+
     """Manage Zone"""
 
     def __init__(self, items):
@@ -2507,6 +2580,7 @@ class Zone:
 
 
 class Pod:
+
     """Manage Pod"""
 
     def __init__(self, items):
@@ -2542,6 +2616,7 @@ class Pod:
 
 
 class PublicIpRange:
+
     """Manage VlanIpRange"""
 
     def __init__(self, items):
@@ -2580,7 +2655,8 @@ class PublicIpRange:
         return(apiclient.listVlanIpRanges(cmd))
 
     @classmethod
-    def dedicate(cls, apiclient, id, account=None, domainid=None, projectid=None):
+    def dedicate(
+            cls, apiclient, id, account=None, domainid=None, projectid=None):
         """Dedicate VLAN IP range"""
 
         cmd = dedicatePublicIpRange.dedicatePublicIpRangeCmd()
@@ -2599,6 +2675,7 @@ class PublicIpRange:
 
 
 class PortablePublicIpRange:
+
     """Manage portable public Ip Range"""
 
     def __init__(self, items):
@@ -2618,7 +2695,8 @@ class PortablePublicIpRange:
         if "vlan" in services:
             cmd.vlan = services["vlan"]
 
-        return PortablePublicIpRange(apiclient.createPortableIpRange(cmd).__dict__)
+        return PortablePublicIpRange(
+            apiclient.createPortableIpRange(cmd).__dict__)
 
     def delete(self, apiclient):
         """Delete portable IpRange"""
@@ -2635,7 +2713,9 @@ class PortablePublicIpRange:
         [setattr(cmd, k, v) for k, v in kwargs.items()]
         return(apiclient.listPortableIpRanges(cmd))
 
+
 class SecondaryStagingStore:
+
     """Manage Staging Store"""
 
     def __init__(self, items):
@@ -2655,7 +2735,8 @@ class SecondaryStagingStore:
             if "scope" in services:
                 cmd.scope = services["scope"]
 
-        return SecondaryStagingStore(apiclient.createSecondaryStagingStore(cmd).__dict__)
+        return SecondaryStagingStore(
+            apiclient.createSecondaryStagingStore(cmd).__dict__)
 
     def delete(self, apiclient):
         """Delete Staging Storage"""
@@ -2671,6 +2752,7 @@ class SecondaryStagingStore:
 
 
 class ImageStore:
+
     """Manage image stores"""
 
     def __init__(self, items):
@@ -2706,6 +2788,7 @@ class ImageStore:
 
 
 class PhysicalNetwork:
+
     """Manage physical network storage"""
 
     def __init__(self, items):
@@ -2746,7 +2829,8 @@ class PhysicalNetwork:
         return apiclient.addTrafficType(cmd)
 
     @classmethod
-    def dedicate(cls, apiclient, vlanrange, physicalnetworkid, account=None, domainid=None, projectid=None):
+    def dedicate(cls, apiclient, vlanrange, physicalnetworkid,
+                 account=None, domainid=None, projectid=None):
         """Dedicate guest vlan range"""
 
         cmd = dedicateGuestVlanRange.dedicateGuestVlanRangeCmd()
@@ -2760,7 +2844,8 @@ class PhysicalNetwork:
     def release(self, apiclient):
         """Release guest vlan range"""
 
-        cmd = releaseDedicatedGuestVlanRange.releaseDedicatedGuestVlanRangeCmd()
+        cmd = releaseDedicatedGuestVlanRange.\
+            releaseDedicatedGuestVlanRangeCmd()
         cmd.id = self.id
         return apiclient.releaseDedicatedGuestVlanRange(cmd)
 
@@ -2778,10 +2863,12 @@ class PhysicalNetwork:
 
         cmd = listPhysicalNetworks.listPhysicalNetworksCmd()
         [setattr(cmd, k, v) for k, v in kwargs.items()]
-        return map(lambda pn : PhysicalNetwork(pn.__dict__), apiclient.listPhysicalNetworks(cmd))
+        return map(lambda pn: PhysicalNetwork(
+            pn.__dict__), apiclient.listPhysicalNetworks(cmd))
 
 
 class SecurityGroup:
+
     """Manage Security Groups"""
 
     def __init__(self, items):
@@ -2873,9 +2960,9 @@ class SecurityGroup:
         cmd.usersecuritygrouplist = []
         for account, group in user_secgrp_list.items():
             cmd.usersecuritygrouplist.append({
-                                            'account': account,
-                                            'group': group
-                                           })
+                'account': account,
+                'group': group
+            })
 
         return (apiclient.authorizeSecurityGroupEgress(cmd).__dict__)
 
@@ -2896,6 +2983,7 @@ class SecurityGroup:
 
 
 class VpnCustomerGateway:
+
     """Manage VPN Customer Gateway"""
 
     def __init__(self, items):
@@ -2903,7 +2991,7 @@ class VpnCustomerGateway:
 
     @classmethod
     def create(cls, apiclient, services, name, gateway, cidrlist,
-                        account=None, domainid=None):
+               account=None, domainid=None):
         """Create VPN Customer Gateway"""
         cmd = createVpnCustomerGateway.createVpnCustomerGatewayCmd()
         cmd.name = name
@@ -2925,7 +3013,8 @@ class VpnCustomerGateway:
             cmd.account = account
         if domainid:
             cmd.domainid = domainid
-        return VpnCustomerGateway(apiclient.createVpnCustomerGateway(cmd).__dict__)
+        return VpnCustomerGateway(
+            apiclient.createVpnCustomerGateway(cmd).__dict__)
 
     def update(self, apiclient, services, name, gateway, cidrlist):
         """Updates VPN Customer Gateway"""
@@ -2966,6 +3055,7 @@ class VpnCustomerGateway:
 
 
 class Project:
+
     """Manage Project life cycle"""
 
     def __init__(self, items):
@@ -3051,6 +3141,7 @@ class Project:
 
 
 class ProjectInvitation:
+
     """Manage project invitations"""
 
     def __init__(self, items):
@@ -3087,6 +3178,7 @@ class ProjectInvitation:
 
 
 class Configurations:
+
     """Manage Configuration"""
 
     @classmethod
@@ -3108,13 +3200,15 @@ class Configurations:
 
 
 class NetScaler:
+
     """Manage external netscaler device"""
 
     def __init__(self, items):
         self.__dict__.update(items)
 
     @classmethod
-    def add(cls, apiclient, services, physicalnetworkid, username=None, password=None):
+    def add(cls, apiclient, services, physicalnetworkid,
+            username=None, password=None):
         """Add external netscaler device to cloudstack"""
 
         cmd = addNetscalerLoadBalancer.addNetscalerLoadBalancerCmd()
@@ -3134,11 +3228,14 @@ class NetScaler:
         # Generate the URL
         url = 'https://' + str(services["ipaddress"]) + '?'
         url = url + 'publicinterface=' + str(services["publicinterface"]) + '&'
-        url = url + 'privateinterface=' + str(services["privateinterface"]) + '&'
+        url = url + 'privateinterface=' + \
+            str(services["privateinterface"]) + '&'
         url = url + 'numretries=' + str(services["numretries"]) + '&'
 
-        if not services["lbdevicededicated"] and "lbdevicecapacity" in services:
-            url = url + 'lbdevicecapacity=' + str(services["lbdevicecapacity"]) + '&'
+        if not services["lbdevicededicated"] and \
+           "lbdevicecapacity" in services:
+            url = url + 'lbdevicecapacity=' + \
+                str(services["lbdevicecapacity"]) + '&'
 
         url = url + 'lbdevicededicated=' + str(services["lbdevicededicated"])
 
@@ -3156,7 +3253,8 @@ class NetScaler:
     def configure(self, apiclient, **kwargs):
         """List already registered netscaler devices"""
 
-        cmd = configureNetscalerLoadBalancer.configureNetscalerLoadBalancerCmd()
+        cmd = configureNetscalerLoadBalancer.\
+            configureNetscalerLoadBalancerCmd()
         cmd.lbdeviceid = self.lbdeviceid
         [setattr(cmd, k, v) for k, v in kwargs.items()]
         return(apiclient.configureNetscalerLoadBalancer(cmd))
@@ -3171,6 +3269,7 @@ class NetScaler:
 
 
 class NetworkServiceProvider:
+
     """Manage network serivce providers for CloudStack"""
 
     def __init__(self, items):
@@ -3184,7 +3283,8 @@ class NetworkServiceProvider:
         cmd.name = name
         cmd.physicalnetworkid = physicalnetworkid
         cmd.servicelist = servicelist
-        return NetworkServiceProvider(apiclient.addNetworkServiceProvider(cmd).__dict__)
+        return NetworkServiceProvider(
+            apiclient.addNetworkServiceProvider(cmd).__dict__)
 
     def delete(self, apiclient):
         """Deletes network service provider"""
@@ -3220,6 +3320,7 @@ class NetworkServiceProvider:
 
 
 class Router:
+
     """Manage router life cycle"""
 
     def __init__(self, items):
@@ -3273,6 +3374,7 @@ class Router:
 
 
 class Tag:
+
     """Manage tags"""
 
     def __init__(self, items):
@@ -3288,9 +3390,9 @@ class Tag:
         cmd.tags = []
         for key, value in tags.items():
             cmd.tags.append({
-                             'key': key,
-                             'value': value
-                            })
+                'key': key,
+                'value': value
+            })
         return Tag(apiclient.createTags(cmd).__dict__)
 
     def delete(self, apiclient, resourceIds, resourceType, tags):
@@ -3302,9 +3404,9 @@ class Tag:
         cmd.tags = []
         for key, value in tags.items():
             cmd.tags.append({
-                             'key': key,
-                             'value': value
-                             })
+                'key': key,
+                'value': value
+            })
         apiclient.deleteTags(cmd)
 
     @classmethod
@@ -3317,6 +3419,7 @@ class Tag:
 
 
 class VpcOffering:
+
     """Manage VPC offerings"""
 
     def __init__(self, items):
@@ -3333,18 +3436,19 @@ class VpcOffering:
         if "serviceProviderList" in services:
             for service, provider in services["serviceProviderList"].items():
                 cmd.serviceproviderlist.append({
-                                            'service': service,
-                                            'provider': provider
-                                           })
+                    'service': service,
+                    'provider': provider
+                })
         if "serviceCapabilityList" in services:
             cmd.servicecapabilitylist = []
-            for service, capability in services["serviceCapabilityList"].items():
+            for service, capability in \
+                services["serviceCapabilityList"].items():
                 for ctype, value in capability.items():
                     cmd.servicecapabilitylist.append({
-                                            'service': service,
-                                            'capabilitytype': ctype,
-                                            'capabilityvalue': value
-                                           })
+                        'service': service,
+                        'capabilitytype': ctype,
+                        'capabilityvalue': value
+                    })
         return VpcOffering(apiclient.createVPCOffering(cmd).__dict__)
 
     def update(self, apiclient, name=None, displaytext=None, state=None):
@@ -3377,6 +3481,7 @@ class VpcOffering:
 
 
 class VPC:
+
     """Manage Virtual Private Connection"""
 
     def __init__(self, items):
@@ -3384,7 +3489,8 @@ class VPC:
 
     @classmethod
     def create(cls, apiclient, services, vpcofferingid,
-                    zoneid, networkDomain=None, account=None, domainid=None, **kwargs):
+               zoneid, networkDomain=None, account=None,
+               domainid=None, **kwargs):
         """Creates the virtual private connection (VPC)"""
 
         cmd = createVPC.createVPCCmd()
@@ -3438,6 +3544,7 @@ class VPC:
 
 
 class PrivateGateway:
+
     """Manage private gateway lifecycle"""
 
     def __init__(self, items):
@@ -3445,7 +3552,7 @@ class PrivateGateway:
 
     @classmethod
     def create(cls, apiclient, gateway, ipaddress, netmask, vlan, vpcid,
-                                                    physicalnetworkid=None):
+               physicalnetworkid=None):
         """Create private gateway"""
 
         cmd = createPrivateGateway.createPrivateGatewayCmd()
@@ -3476,6 +3583,7 @@ class PrivateGateway:
 
 
 class AffinityGroup:
+
     def __init__(self, items):
         self.__dict__.update(items)
 
@@ -3505,8 +3613,11 @@ class AffinityGroup:
         [setattr(cmd, k, v) for k, v in kwargs.items()]
         return apiclient.listAffinityGroups(cmd)
 
+
 class StaticRoute:
+
     """Manage static route lifecycle"""
+
     def __init__(self, items):
         self.__dict__.update(items)
 
@@ -3536,11 +3647,14 @@ class StaticRoute:
 
 
 class VNMC:
+
     """Manage VNMC lifecycle"""
+
     def __init__(self, items):
         self.__dict__.update(items)
 
-    def create(cls, apiclient, hostname, username, password, physicalnetworkid):
+    def create(cls, apiclient, hostname, username, password,
+               physicalnetworkid):
         """Registers VNMC appliance"""
 
         cmd = addCiscoVnmcResource.addCiscoVnmcResourceCmd()
@@ -3567,6 +3681,7 @@ class VNMC:
 
 
 class SSHKeyPair:
+
     """Manage SSH Key pairs"""
 
     def __init__(self, items, services):
@@ -3574,7 +3689,7 @@ class SSHKeyPair:
 
     @classmethod
     def create(cls, apiclient, name=None, account=None,
-                    domainid=None, projectid=None):
+               domainid=None, projectid=None):
         """Creates SSH keypair"""
         cmd = createSSHKeyPair.createSSHKeyPairCmd()
         cmd.name = name
@@ -3609,6 +3724,7 @@ class SSHKeyPair:
 
 
 class Capacities:
+
     """Manage Capacities"""
 
     @classmethod
@@ -3621,6 +3737,7 @@ class Capacities:
 
 
 class Alert:
+
     """Manage alerts"""
 
     @classmethod
@@ -3633,6 +3750,7 @@ class Alert:
 
 
 class InstanceGroup:
+
     """Manage VM instance groups"""
 
     def __init__(self, items):
@@ -3706,7 +3824,8 @@ class InstanceGroup:
     def changeServiceOffering(self, apiclient, serviceOfferingId):
         """Change service offering of the vm tier"""
 
-        cmd = changeServiceForVirtualMachine.changeServiceForVirtualMachineCmd()
+        cmd = changeServiceForVirtualMachine.\
+            changeServiceForVirtualMachineCmd()
         cmd.group = self.id
         cmd.serviceofferingid = serviceOfferingId
         return apiclient.changeServiceForVirtualMachine(cmd)
@@ -3719,8 +3838,10 @@ class InstanceGroup:
 
 
 class ASA1000V:
+
     """Manage ASA 1000v lifecycle"""
-    def create(cls, apiclient, hostname, insideportprofile, clusterid, physicalnetworkid):
+    def create(cls, apiclient, hostname, insideportprofile,
+               clusterid, physicalnetworkid):
         """Registers ASA 1000v appliance"""
 
         cmd = addCiscoAsa1000vResource.addCiscoAsa1000vResourceCmd()
@@ -3745,12 +3866,17 @@ class ASA1000V:
         [setattr(cmd, k, v) for k, v in kwargs.items()]
         return(apiclient.listCiscoAsa1000vResources(cmd))
 
+
 class VmSnapshot:
+
     """Manage VM Snapshot life cycle"""
+
     def __init__(self, items):
         self.__dict__.update(items)
+
     @classmethod
-    def create(cls,apiclient,vmid,snapshotmemory="false",name=None,description=None):
+    def create(cls, apiclient, vmid, snapshotmemory="false",
+               name=None, description=None):
         cmd = createVMSnapshot.createVMSnapshotCmd()
         cmd.virtualmachineid = vmid
 
@@ -3761,29 +3887,32 @@ class VmSnapshot:
         if description:
             cmd.description = description
         return VmSnapshot(apiclient.createVMSnapshot(cmd).__dict__)
-    
+
     @classmethod
     def list(cls, apiclient, **kwargs):
         cmd = listVMSnapshot.listVMSnapshotCmd()
         [setattr(cmd, k, v) for k, v in kwargs.items()]
         return(apiclient.listVMSnapshot(cmd))
-    
+
     @classmethod
-    def revertToSnapshot(cls, apiclient,vmsnapshotid):
+    def revertToSnapshot(cls, apiclient, vmsnapshotid):
         cmd = revertToVMSnapshot.revertToVMSnapshotCmd()
         cmd.vmsnapshotid = vmsnapshotid
-        
+
         return apiclient.revertToVMSnapshot(cmd)
-    
+
     @classmethod
-    def deleteVMSnapshot(cls,apiclient,vmsnapshotid):
+    def deleteVMSnapshot(cls, apiclient, vmsnapshotid):
         cmd = deleteVMSnapshot.deleteVMSnapshotCmd()
         cmd.vmsnapshotid = vmsnapshotid
-        
+
         return apiclient.deleteVMSnapshot(cmd)
 
+
 class Region:
+
     """ Regions related Api """
+
     def __init__(self, items):
         self.__dict__.update(items)
 
@@ -3825,14 +3954,16 @@ class Region:
 
 
 class ApplicationLoadBalancer:
+
     """Manage Application Load Balancers in VPC"""
 
     def __init__(self, items):
         self.__dict__.update(items)
 
     @classmethod
-    def create(cls, apiclient, services, name=None, sourceport=None, instanceport=22,
-               algorithm="roundrobin", scheme="internal", sourcenetworkid=None, networkid=None):
+    def create(cls, apiclient, services, name=None, sourceport=None,
+               instanceport=22, algorithm="roundrobin", scheme="internal",
+               sourcenetworkid=None, networkid=None):
         """Create Application Load Balancer"""
         cmd = createLoadBalancer.createLoadBalancerCmd()
 
@@ -3903,7 +4034,9 @@ class ApplicationLoadBalancer:
         [setattr(cmd, k, v) for k, v in kwargs.items()]
         return(apiclient.listLoadBalancerRules(cmd))
 
+
 class Resources:
+
     """Manage resource limits"""
 
     def __init__(self, items, services):
@@ -3932,9 +4065,12 @@ class Resources:
         cmd = updateResourceCount.updateResourceCountCmd()
         [setattr(cmd, k, v) for k, v in kwargs.items()]
         return(apiclient.updateResourceCount(cmd))
-   
+
+
 class NIC:
+
     """NIC related API"""
+
     def __init__(self, items):
         self.__dict__.update(items)
 
@@ -3948,7 +4084,7 @@ class NIC:
         return(apiclient.addIpToNic(cmd))
 
     @classmethod
-    def removeIp(cls,apiclient,ipaddressid):
+    def removeIp(cls, apiclient, ipaddressid):
         """Remove secondary Ip from NIC"""
         cmd = removeIpFromNic.removeIpFromNicCmd()
         cmd.id = ipaddressid
@@ -3961,8 +4097,10 @@ class NIC:
         cmd = listNics.listNicsCmd()
         [setattr(cmd, k, v) for k, v in kwargs.items()]
         return(apiclient.listNics(cmd))
-        
+
+
 class IAMGroup:
+
     def __init__(self, items):
         self.__dict__.update(items)
 
@@ -3989,8 +4127,8 @@ class IAMGroup:
     def list(cls, apiclient, **kwargs):
         cmd = listIAMGroups.listIAMGroupsCmd()
         [setattr(cmd, k, v) for k, v in kwargs.items()]
-        return apiclient.listIAMGroupsCmd(cmd)  
-    
+        return apiclient.listIAMGroupsCmd(cmd)
+
     def addAccount(self, apiclient, accts):
         """Add accounts to iam group"""
         cmd = addAccountToIAMGroup.addAccountToIAMGroupCmd()
@@ -4023,7 +4161,9 @@ class IAMGroup:
         apiclient.removeIAMPolicyFromIAMGroup(cmd)
         return
 
+
 class IAMPolicy:
+
     def __init__(self, items):
         self.__dict__.update(items)
 
@@ -4050,7 +4190,7 @@ class IAMPolicy:
     def list(cls, apiclient, **kwargs):
         cmd = listIAMPolicies.listIAMPoliciesCmd()
         [setattr(cmd, k, v) for k, v in kwargs.items()]
-        return apiclient.listIAMPoliciesCmd(cmd)  
+        return apiclient.listIAMPoliciesCmd(cmd)
 
     def addPermission(self, apiclient, permission):
         """Add permission to iam policy"""
@@ -4065,7 +4205,8 @@ class IAMPolicy:
 
     def removePermission(self, apiclient, permission):
         """Remove permission from iam policy"""
-        cmd = removeIAMPermissionFromIAMPolicy.removeIAMPermissionFromIAMPolicyCmd()
+        cmd = removeIAMPermissionFromIAMPolicy.\
+            removeIAMPermissionFromIAMPolicyCmd()
         cmd.id = self.id
         cmd.action = permission['action']
         cmd.entitytype = permission['entitytype']
@@ -4090,15 +4231,20 @@ class IAMPolicy:
         apiclient.removeIAMPolicyFromAccount(cmd)
         return
 
+
 class SimulatorMock:
+
     """Manage simulator mock lifecycle"""
+
     def __init__(self, items):
         self.__dict__.update(items)
-    
+
     @classmethod
-    def create(cls, apiclient, command, zoneid=None, podid=None, clusterid=None, hostid=None, value="result:fail", count=None, jsonresponse=None):
+    def create(cls, apiclient, command, zoneid=None, podid=None,
+               clusterid=None, hostid=None, value="result:fail",
+               count=None, jsonresponse=None):
         """Creates simulator mock"""
-        
+
         cmd = configureSimulator.configureSimulatorCmd()
         cmd.zoneid = zoneid
         cmd.podid = podid
@@ -4114,17 +4260,17 @@ class SimulatorMock:
                 return SimulatorMock(simulatormock.__dict__)
         except Exception as e:
             raise e
-    
+
     def delete(self, apiclient):
         """Removes simulator mock"""
-        
+
         cmd = cleanupSimulatorMock.cleanupSimulatorMockCmd()
         cmd.id = self.id
         return apiclient.cleanupSimulatorMock(cmd)
-    
+
     def query(self, apiclient):
         """Queries simulator mock"""
-        
+
         cmd = querySimulatorMock.querySimulatorMockCmd()
         cmd.id = self.id
         try:
@@ -4133,5 +4279,3 @@ class SimulatorMock:
                 return SimulatorMock(simulatormock.__dict__)
         except Exception as e:
             raise e
-
-

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/4a99cf85/tools/marvin/marvin/lib/common.py
----------------------------------------------------------------------
diff --git a/tools/marvin/marvin/lib/common.py b/tools/marvin/marvin/lib/common.py
index 8868d2d..0a82f93 100644
--- a/tools/marvin/marvin/lib/common.py
+++ b/tools/marvin/marvin/lib/common.py
@@ -59,8 +59,6 @@ from marvin.cloudstackAPI import (listConfigurations,
                                   listVPCOfferings)
 
 
-
-
 from marvin.sshClient import SshClient
 from marvin.codes import (PASS, ISOLATED_NETWORK, VPC_NETWORK,
                           BASIC_ZONE, FAIL, NAT_RULE, STATIC_NAT_RULE)
@@ -76,7 +74,8 @@ import time
 
 def is_config_suitable(apiclient, name, value):
     """
-    Ensure if the deployment has the expected `value` for the global setting `name'
+    Ensure if the deployment has the expected
+    `value` for the global setting `name'
     @return: true if value is set, else false
     """
     configs = Configurations.list(apiclient, name=name)
@@ -151,7 +150,8 @@ def add_netscaler(apiclient, zoneid, NSservice):
 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
+    @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
@@ -237,10 +237,12 @@ def get_pod(apiclient, zone_id=None, pod_id=None, pod_name=None):
     if validateList(cmd_out)[0] != PASS:
         return FAILED
     return cmd_out[0]
+
+
 def get_template(
-        apiclient, zone_id=None, ostype_desc=None, template_filter="featured", template_type='BUILTIN',
-        template_id=None, template_name=None, account=None, domain_id=None, project_id=None,
-        hypervisor=None):
+        apiclient, zone_id=None, ostype_desc=None, template_filter="featured",
+        template_type='BUILTIN', template_id=None, template_name=None,
+        account=None, domain_id=None, project_id=None, hypervisor=None):
     '''
     @Name : get_template
     @Desc : Retrieves the template Information based upon inputs provided
@@ -759,20 +761,24 @@ def update_resource_count(apiclient, domainid, accountid=None,
                           )
     return
 
+
 def findSuitableHostForMigration(apiclient, vmid):
     """Returns a suitable host for VM migration"""
     suitableHost = None
     try:
         hosts = Host.listForMigration(apiclient, virtualmachineid=vmid,
-                )
+                                      )
     except Exception as e:
-        raise Exception("Exception while getting hosts list suitable for migration: %s" % e)
+        raise Exception(
+            "Exception while getting hosts list suitable for migration: %s" %
+            e)
 
     suitablehosts = []
     if isinstance(hosts, list) and len(hosts) > 0:
-        suitablehosts = [host for host in hosts if (str(host.resourcestate).lower() == "enabled"\
-                and str(host.state).lower() == "up")]
-        if len(suitablehosts)>0:
+        suitablehosts = [host for host in hosts
+                         if (str(host.resourcestate).lower() == "enabled"
+                             and str(host.state).lower() == "up")]
+        if len(suitablehosts) > 0:
             suitableHost = suitablehosts[0]
 
     return suitableHost
@@ -798,10 +804,10 @@ def get_resource_type(resource_id):
     return lookup[resource_id]
 
 
-
 def get_free_vlan(apiclient, zoneid):
     """
-    Find an unallocated VLAN outside the range allocated to the physical network.
+    Find an unallocated VLAN outside the range
+    allocated to the physical network.
 
     @note: This does not guarantee that the VLAN is available for use in
     the deployment's network gear
@@ -813,7 +819,8 @@ def get_free_vlan(apiclient, zoneid):
     )
     assert isinstance(list_physical_networks_response, list)
     assert len(
-        list_physical_networks_response) > 0, "No physical networks found in zone %s" % zoneid
+        list_physical_networks_response) > 0,\
+        "No physical networks found in zone %s" % zoneid
 
     physical_network = list_physical_networks_response[0]
 
@@ -836,7 +843,8 @@ def get_free_vlan(apiclient, zoneid):
 
         assert len(vlans) > 0
         assert int(vlans[0]) < int(
-            vlans[-1]), "VLAN range  %s was improperly split" % physical_network.vlan
+            vlans[-1]), "VLAN range  %s was improperly split"\
+                        % physical_network.vlan
 
         # Assuming random function will give different integer each time
         retriesCount = 20
@@ -864,7 +872,8 @@ def get_free_vlan(apiclient, zoneid):
 
 def setNonContiguousVlanIds(apiclient, zoneid):
     """
-    Form the non contiguous ranges based on currently assigned range in physical network
+    Form the non contiguous ranges based on currently
+     assigned range in physical network
     """
 
     NonContigVlanIdsAcquired = False
@@ -875,7 +884,8 @@ def setNonContiguousVlanIds(apiclient, zoneid):
     )
     assert isinstance(list_physical_networks_response, list)
     assert len(
-        list_physical_networks_response) > 0, "No physical networks found in zone %s" % zoneid
+        list_physical_networks_response) > 0, \
+        "No physical networks found in zone %s" % zoneid
 
     for physical_network in list_physical_networks_response:
 
@@ -883,26 +893,30 @@ def setNonContiguousVlanIds(apiclient, zoneid):
 
         assert len(vlans) > 0
         assert int(vlans[0]) < int(
-            vlans[-1]), "VLAN range  %s was improperly split" % physical_network.vlan
+            vlans[-1]), "VLAN range  %s was improperly split"\
+                        % physical_network.vlan
 
-        # Keep some gap between existing vlan and the new vlans which we are going to add
+        # Keep some gap between existing vlan and the new vlans
+        # which we are going to add
         # So that they are non contiguous
 
         non_contig_end_vlan_id = int(vlans[-1]) + 6
         non_contig_start_vlan_id = int(vlans[0]) - 6
 
-        # Form ranges which are consecutive to existing ranges but not immediately contiguous
-        # There should be gap in between existing range and new non contiguous
-        # ranage
-
-        # If you can't add range after existing range, because it's crossing 4095, then
-        # select VLAN ids before the existing range such that they are greater than 0, and
+        # Form ranges which are consecutive to existing ranges but
+        # not immediately contiguous
+        # There should be gap in between existing range
+        # and new non contiguous range
+        # If you can't add range after existing range,
+        # because it's crossing 4095, then select VLAN ids before
+        # the existing range such that they are greater than 0, and
         # then add this non contiguoud range
         vlan = {"partial_range": ["", ""], "full_range": ""}
 
         if non_contig_end_vlan_id < 4095:
             vlan["partial_range"][0] = str(
-                non_contig_end_vlan_id - 4) + '-' + str(non_contig_end_vlan_id - 3)
+                non_contig_end_vlan_id - 4) + '-' + str(non_contig_end_vlan_id
+                                                        - 3)
             vlan["partial_range"][1] = str(
                 non_contig_end_vlan_id - 1) + '-' + str(non_contig_end_vlan_id)
             vlan["full_range"] = str(
@@ -910,12 +924,15 @@ def setNonContiguousVlanIds(apiclient, zoneid):
             NonContigVlanIdsAcquired = True
 
         elif non_contig_start_vlan_id > 0:
-            vlan["partial_range"][0] = str(
-                non_contig_start_vlan_id) + '-' + str(non_contig_start_vlan_id + 1)
-            vlan["partial_range"][1] = str(
-                non_contig_start_vlan_id + 3) + '-' + str(non_contig_start_vlan_id + 4)
-            vlan["full_range"] = str(
-                non_contig_start_vlan_id) + '-' + str(non_contig_start_vlan_id + 4)
+            vlan["partial_range"][0] = \
+                str(non_contig_start_vlan_id) \
+                + '-' + str(non_contig_start_vlan_id + 1)
+            vlan["partial_range"][1] = \
+                str(non_contig_start_vlan_id + 3) \
+                + '-' + str(non_contig_start_vlan_id + 4)
+            vlan["full_range"] = \
+                str(non_contig_start_vlan_id) \
+                + '-' + str(non_contig_start_vlan_id + 4)
             NonContigVlanIdsAcquired = True
 
         else:
@@ -930,7 +947,8 @@ def setNonContiguousVlanIds(apiclient, zoneid):
         else:
             break
 
-    # If even through looping from all existing physical networks, failed to get relevant non
+    # If even through looping from all existing physical networks,
+    # failed to get relevant non
     # contiguous vlan ids, then fail the test case
 
     if not NonContigVlanIdsAcquired:
@@ -938,84 +956,111 @@ def setNonContiguousVlanIds(apiclient, zoneid):
 
     return physical_network, vlan
 
+
 def is_public_ip_in_correct_state(apiclient, ipaddressid, state):
     """ Check if the given IP is in the correct state (given)
     and return True/False accordingly"""
     retriesCount = 10
     while True:
         portableips = PublicIPAddress.list(apiclient, id=ipaddressid)
-        assert validateList(portableips)[0] == PASS, "IPs list validation failed"
+        assert validateList(
+            portableips)[0] == PASS, "IPs list validation failed"
         if str(portableips[0].state).lower() == state:
             break
         elif retriesCount == 0:
-           return False
+            return False
         else:
             retriesCount -= 1
             time.sleep(60)
             continue
     return True
 
+
 def setSharedNetworkParams(networkServices, range=20):
-    """Fill up the services dictionary for shared network using random subnet"""
+    """Fill up the services dictionary for shared network
+    using random subnet
+    """
 
-    # @range: range decides the endip. Pass the range as "x" if you want the difference between the startip
+    # @range: range decides the endip. Pass the range as "x"
+    # if you want the difference between the startip
     # and endip as "x"
     # Set the subnet number of shared networks randomly prior to execution
     # of each test case to avoid overlapping of ip addresses
-    shared_network_subnet_number = random.randrange(1,254)
-
-    networkServices["gateway"] = "172.16."+str(shared_network_subnet_number)+".1"
-    networkServices["startip"] = "172.16."+str(shared_network_subnet_number)+".2"
-    networkServices["endip"] = "172.16."+str(shared_network_subnet_number)+"."+str(range+1)
+    shared_network_subnet_number = random.randrange(1, 254)
+
+    networkServices["gateway"] = "172.16." + \
+        str(shared_network_subnet_number) + ".1"
+    networkServices["startip"] = "172.16." + \
+        str(shared_network_subnet_number) + ".2"
+    networkServices["endip"] = "172.16." + \
+        str(shared_network_subnet_number) + "." + str(range + 1)
     networkServices["netmask"] = "255.255.255.0"
     return networkServices
 
+
 def createEnabledNetworkOffering(apiclient, networkServices):
     """Create and enable network offering according to the type
 
        @output: List, containing [ Result,Network Offering,Reason ]
-                 Ist Argument('Result') : FAIL : If exception or assertion error occurs
+                 Ist Argument('Result') : FAIL : If exception or assertion
+                                          error occurs
                                           PASS : If network offering
                                           is created and enabled successfully
                  IInd Argument(Net Off) : Enabled network offering
                                                 In case of exception or
-                                                assertion error, it will be None
+                                                assertion error, it will be
+                                                None
                  IIIrd Argument(Reason) :  Reason for failure,
                                               default to None
     """
     try:
         resultSet = [FAIL, None, None]
         # Create network offering
-        network_offering = NetworkOffering.create(apiclient, networkServices, conservemode=False)
+        network_offering = NetworkOffering.create(
+            apiclient,
+            networkServices,
+            conservemode=False)
 
         # Update network offering state from disabled to enabled.
-        NetworkOffering.update(network_offering, apiclient, id=network_offering.id,
+        NetworkOffering.update(network_offering,
+                               apiclient, id=network_offering.id,
                                state="enabled")
     except Exception as e:
         resultSet[2] = e
         return resultSet
     return [PASS, network_offering, None]
 
+
 def shouldTestBeSkipped(networkType, zoneType):
     """Decide which test to skip, according to type of network and zone type"""
 
-    # If network type is isolated or vpc and zone type is basic, then test should be skipped
+    # If network type is isolated or vpc and zone type is basic, then test
+    # should be skipped
     skipIt = False
-    if ((networkType.lower() == str(ISOLATED_NETWORK).lower() or networkType.lower() == str(VPC_NETWORK).lower())
-            and (zoneType.lower() == BASIC_ZONE)):
+    if (networkType.lower() == str(ISOLATED_NETWORK).lower() or
+        networkType.lower() == str(VPC_NETWORK).lower()) and\
+        (zoneType.lower() == BASIC_ZONE):
         skipIt = True
     return skipIt
 
+
 def verifyNetworkState(apiclient, networkid, state):
     """List networks and check if the network state matches the given state"""
     try:
         networks = Network.list(apiclient, id=networkid)
     except Exception as e:
-        raise Exception("Failed while fetching network list with error: %s" % e)
-    assert validateList(networks)[0] == PASS, "Networks list validation failed, list is %s" % networks
-    assert str(networks[0].state).lower() == state, "network state should be %s, it is %s" % (state, networks[0].state)
+        raise Exception(
+            "Failed while fetching network list with error: %s" %
+            e)
+    assert validateList(
+        networks)[0] == PASS, "Networks list validation failed, list is %s"\
+                              % networks
+    assert str(networks[0].state).lower(
+    ) == state, "network state should be %s, it is %s" \
+                % (state, networks[0].state)
     return
 
+
 def verifyComputeOfferingCreation(apiclient, computeofferingid):
     """List Compute offerings by ID and verify that the offering exists"""
 
@@ -1025,11 +1070,12 @@ def verifyComputeOfferingCreation(apiclient, computeofferingid):
     try:
         serviceOfferings = apiclient.listServiceOfferings(cmd)
     except Exception:
-       return FAIL
+        return FAIL
     if not (isinstance(serviceOfferings, list) and len(serviceOfferings) > 0):
-       return FAIL
+        return FAIL
     return PASS
 
+
 def createNetworkRulesForVM(apiclient, virtualmachine, ruletype,
                             account, networkruledata):
     """Acquire IP, create Firewall and NAT/StaticNAT rule
@@ -1037,26 +1083,28 @@ def createNetworkRulesForVM(apiclient, virtualmachine, ruletype,
 
     try:
         public_ip = PublicIPAddress.create(
-                apiclient,accountid=account.name,
-                zoneid=virtualmachine.zoneid,domainid=account.domainid,
-                networkid=virtualmachine.nic[0].networkid)
+            apiclient, accountid=account.name,
+            zoneid=virtualmachine.zoneid, domainid=account.domainid,
+            networkid=virtualmachine.nic[0].networkid)
 
         FireWallRule.create(
-            apiclient,ipaddressid=public_ip.ipaddress.id,
+            apiclient, ipaddressid=public_ip.ipaddress.id,
             protocol='TCP', cidrlist=[networkruledata["fwrule"]["cidr"]],
             startport=networkruledata["fwrule"]["startport"],
             endport=networkruledata["fwrule"]["endport"]
-            )
+        )
 
         if ruletype == NAT_RULE:
             # Create NAT rule
             NATRule.create(apiclient, virtualmachine,
-                                 networkruledata["natrule"],ipaddressid=public_ip.ipaddress.id,
-                                 networkid=virtualmachine.nic[0].networkid)
+                           networkruledata[
+                               "natrule"], ipaddressid=public_ip.ipaddress.id,
+                           networkid=virtualmachine.nic[0].networkid)
         elif ruletype == STATIC_NAT_RULE:
             # Enable Static NAT for VM
-            StaticNATRule.enable(apiclient,public_ip.ipaddress.id,
-                                     virtualmachine.id, networkid=virtualmachine.nic[0].networkid)
+            StaticNATRule.enable(apiclient, public_ip.ipaddress.id,
+                                 virtualmachine.id,
+                                 networkid=virtualmachine.nic[0].networkid)
     except Exception as e:
         [FAIL, e]
     return [PASS, public_ip]