You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by ta...@apache.org on 2014/12/22 09:25:29 UTC

[1/4] git commit: updated refs/heads/4.5 to 3736d94

Repository: cloudstack
Updated Branches:
  refs/heads/4.5 788fe5a27 -> 3736d9435


CLOUDSTACK-8095: Fixed Iso attach issue in test_escalations_instances.py

Signed-off-by: SrikanteswaraRao Talluri <ta...@apache.org>


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

Branch: refs/heads/4.5
Commit: a2fa2e49113ad1a9cf921a621952b35bb8349655
Parents: 788fe5a
Author: Ashutosh K <as...@clogeny.com>
Authored: Fri Dec 19 12:51:07 2014 +0530
Committer: SrikanteswaraRao Talluri <ta...@apache.org>
Committed: Mon Dec 22 13:53:01 2014 +0530

----------------------------------------------------------------------
 .../component/test_escalations_instances.py     | 182 ++++++++++---------
 1 file changed, 96 insertions(+), 86 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/a2fa2e49/test/integration/component/test_escalations_instances.py
----------------------------------------------------------------------
diff --git a/test/integration/component/test_escalations_instances.py b/test/integration/component/test_escalations_instances.py
index e79cd3d..c5afa27 100644
--- a/test/integration/component/test_escalations_instances.py
+++ b/test/integration/component/test_escalations_instances.py
@@ -1577,8 +1577,7 @@ class TestListInstances(cloudstackTestCase):
         new_keypair = SSHKeyPair.register(
             self.userapiclient,
             name="keypair1",
-            publickey="ssh-rsa: e6:9a:1e:b5:98:75:88:5d:56:bc:92:7b:43:48:05:b2"
-            )
+            publickey="ssh-rsa: e6:9a:1e:b5:98:75:88:5d:56:bc:92:7b:43:48:05:b2")
         self.assertIsNotNone(
             new_keypair,
             "New Key pair generation failed"
@@ -2042,27 +2041,27 @@ class TestListInstances(cloudstackTestCase):
             )
             status = validateList(list_vms_after)
             self.assertEquals(
-            PASS,
-            status[0],
-            "Listing of VM failed"
+                PASS,
+                status[0],
+                "Listing of VM failed"
             )
             vm = list_vms_after[0]
             # Verifying that VM nics size is 1 now
             vm_nics_after = vm.nic
             self.assertIsNotNone(
-            vm_nics_after,
-            "Nic not found for the deployed VM"
+                vm_nics_after,
+                "Nic not found for the deployed VM"
             )
             self.assertEquals(
-            1,
-            len(vm_nics_after),
-            "VM NIC's count is not matching"
+                1,
+                len(vm_nics_after),
+                "VM NIC's count is not matching"
             )
             # Verifying the nic network is same as the default nic network
             self.assertEquals(
-            network2.id,
-            vm_nics_after[0].networkid,
-            "VM NIC is not same as expected"
+                network2.id,
+                vm_nics_after[0].networkid,
+                "VM NIC is not same as expected"
             )
         return
 
@@ -2125,23 +2124,23 @@ class TestInstances(cloudstackTestCase):
         self.apiClient = self.testClient.getApiClient()
         self.cleanup = []
         self.account = Account.create(
-                self.apiClient,
-                self.services["account"],
-                domainid=self.domain.id
-            )
-            # Getting authentication for user in newly created Account
+            self.apiClient,
+            self.services["account"],
+            domainid=self.domain.id
+        )
+        # Getting authentication for user in newly created Account
         self.user = self.account.user[0]
         self.userapiclient = self.testClient.getUserApiClient(
-                self.user.username,
-                self.domain.name)
+            self.user.username,
+            self.domain.name)
         # Updating resource Limits
         for i in range(0, 8):
             Resources.updateLimit(
-                    self.api_client,
-                    account=self.account.name,
-                    domainid=self.domain.id,
-                    max=-1,
-                    resourcetype=i
+                self.api_client,
+                account=self.account.name,
+                domainid=self.domain.id,
+                max=-1,
+                resourcetype=i
             )
         self.cleanup.append(self.account)
 
@@ -2239,6 +2238,7 @@ class TestInstances(cloudstackTestCase):
             vm_created,
             "VM creation failed"
         )
+        self.cleanup.append(vm_created)
         # Listing all the VMs for a user again for matching zone
         list_vms_after = VirtualMachine.list(
             self.userapiclient,
@@ -2268,60 +2268,70 @@ class TestInstances(cloudstackTestCase):
             isofilter="executable",
             zoneid=self.zone.id
         )
-        # Verifying if size of the list is >= 1
-        if isos_list is not None:
-            iso_toattach = isos_list[0]
-            # Attaching ISO listed to VM deployed
-            VirtualMachine.attach_iso(
-                vm_created,
-                self.userapiclient,
-                iso_toattach
-            )
-            list_vm = VirtualMachine.list(
-                self.userapiclient,
-                id=vm_created.id
-            )
-            status = validateList(list_vm)
-            self.assertEquals(
-                PASS,
-                status[0],
-                "VM listing by Id failed"
-            )
-            # Verifying that attached ISO details are present in VM
-            self.assertEquals(
-                iso_toattach.name,
-                list_vm[0].isoname,
-                "Attached ISO name is not matching"
-            )
-            self.assertEquals(
-                iso_toattach.displaytext,
-                list_vm[0].isodisplaytext,
-                "Attached ISO display is not matching"
-            )
-            # Detaching ISO from VM
-            VirtualMachine.detach_iso(
-                vm_created,
-                self.userapiclient
-            )
-            list_vm = VirtualMachine.list(
-                self.userapiclient,
-                id=vm_created.id
-            )
-            status = validateList(list_vm)
-            self.assertEquals(
-                PASS,
-                status[0],
-                "VM listing by Id failed"
-            )
-            # Verifying that ISO details are NOT present in VM
-            self.assertIsNone(
-                list_vm[0].isoname,
-                "ISO not detached from VM"
-            )
+
+        self.assertEqual(validateList(isos_list)[0],
+                         PASS,
+                         "isos list validation failed")
+
+        if self.hypervisor.lower() == "xenserver":
+            isoDesc = "xen"
         else:
-            self.fail(
-                "Executable ISO in Ready is not found in the given setup")
+            isoDesc = "vmware"
+
+        validIsosToAttach = [iso for iso in isos_list
+                             if isoDesc in iso.displaytext.lower()]
+        if not validIsosToAttach:
+            self.skipTest(
+                "Valid ISO not present in setup suitable to attach to VM")
 
+        iso_toattach = validIsosToAttach[0]
+        # Attaching ISO listed to VM deployed
+        VirtualMachine.attach_iso(
+            vm_created,
+            self.userapiclient,
+            iso_toattach
+        )
+        list_vm = VirtualMachine.list(
+            self.userapiclient,
+            id=vm_created.id
+        )
+        status = validateList(list_vm)
+        self.assertEquals(
+            PASS,
+            status[0],
+            "VM listing by Id failed"
+        )
+        # Verifying that attached ISO details are present in VM
+        self.assertEquals(
+            iso_toattach.name,
+            list_vm[0].isoname,
+            "Attached ISO name is not matching"
+        )
+        self.assertEquals(
+            iso_toattach.displaytext,
+            list_vm[0].isodisplaytext,
+            "Attached ISO display is not matching"
+        )
+        # Detaching ISO from VM
+        VirtualMachine.detach_iso(
+            vm_created,
+            self.userapiclient
+        )
+        list_vm = VirtualMachine.list(
+            self.userapiclient,
+            id=vm_created.id
+        )
+        status = validateList(list_vm)
+        self.assertEquals(
+            PASS,
+            status[0],
+            "VM listing by Id failed"
+        )
+        # Verifying that ISO details are NOT present in VM
+        self.assertIsNone(
+            list_vm[0].isoname,
+            "ISO not detached from VM"
+        )
         return
 
     @attr(tags=["advanced", "basic"], required_hardware="true")
@@ -2866,9 +2876,9 @@ class TestInstances(cloudstackTestCase):
         )
 
         self.assertEqual(
-                len(volumes),
-                len(list_volumes_page1) - len(list_data_disks),
-                "The volumes number should match with (volumes initially\
+            len(volumes),
+            len(list_volumes_page1) - len(list_data_disks),
+            "The volumes number should match with (volumes initially\
                         present minus volumes detached")
 
         return
@@ -2976,11 +2986,11 @@ class TestInstances(cloudstackTestCase):
             if service_offerings_list is not None:
                 for i in range(0, len(service_offerings_list)):
                     if not ((current_so.cpunumber >
-                            service_offerings_list[i].cpunumber or
+                             service_offerings_list[i].cpunumber or
                              current_so.cpuspeed >
-                            service_offerings_list[i].cpuspeed or
+                             service_offerings_list[i].cpuspeed or
                              current_so.memory >
-                            service_offerings_list[i].memory) or
+                             service_offerings_list[i].memory) or
                             (current_so.cpunumber ==
                                 service_offerings_list[i].cpunumber and
                              current_so.cpuspeed ==
@@ -2989,9 +2999,9 @@ class TestInstances(cloudstackTestCase):
                                 service_offerings_list[i].memory)):
                         if(current_so.storagetype ==
                                 service_offerings_list[i].storagetype):
-                                so_exists = True
-                                new_so = service_offerings_list[i]
-                                break
+                            so_exists = True
+                            new_so = service_offerings_list[i]
+                            break
             # If service offering does not exists, then creating one service
             # offering for scale up
             if not so_exists:


[3/4] git commit: updated refs/heads/4.5 to 3736d94

Posted by ta...@apache.org.
CLOUDSTACK-8100: Fixed pep8 issues in test_vpc.py

Signed-off-by: SrikanteswaraRao Talluri <ta...@apache.org>


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

Branch: refs/heads/4.5
Commit: 588e7dc8110e1cd03c87a97bd8ac39be0c0b1ed4
Parents: a2fa2e4
Author: Gaurav Aradhye <ga...@clogeny.com>
Authored: Fri Dec 19 18:59:53 2014 +0530
Committer: SrikanteswaraRao Talluri <ta...@apache.org>
Committed: Mon Dec 22 13:53:10 2014 +0530

----------------------------------------------------------------------
 test/integration/component/test_vpc.py | 2585 ++++++++++++++-------------
 1 file changed, 1301 insertions(+), 1284 deletions(-)
----------------------------------------------------------------------



[4/4] git commit: updated refs/heads/4.5 to 3736d94

Posted by ta...@apache.org.
CLOUDSTACK-7762 -[Automation] - Fix test failure for test_02_revert_vm_snapshots in smoke/test_vm_snapshots.py


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

Branch: refs/heads/4.5
Commit: 3736d9435ad7e26f889dbb3b90fa7ce457ea4967
Parents: 588e7dc8
Author: Sangeetha Hariharan <sa...@citrix.com>
Authored: Tue Oct 21 18:12:03 2014 -0700
Committer: SrikanteswaraRao Talluri <ta...@apache.org>
Committed: Mon Dec 22 13:55:07 2014 +0530

----------------------------------------------------------------------
 test/integration/smoke/test_vm_snapshots.py | 3 +++
 1 file changed, 3 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/3736d943/test/integration/smoke/test_vm_snapshots.py
----------------------------------------------------------------------
diff --git a/test/integration/smoke/test_vm_snapshots.py b/test/integration/smoke/test_vm_snapshots.py
index 131da99..ef1353a 100644
--- a/test/integration/smoke/test_vm_snapshots.py
+++ b/test/integration/smoke/test_vm_snapshots.py
@@ -202,6 +202,9 @@ class TestVmSnapshot(cloudstackTestCase):
             "Check the snapshot of vm is ready!"
         )
 
+	# Stop Virtual machine befor reverting VM to a snapshot taken without memory  	
+	self.virtual_machine.stop(self.apiclient)
+
         VmSnapshot.revertToSnapshot(self.apiclient, list_snapshot_response[0].id)
 
         list_vm_response = list_virtual_machines(


[2/4] git commit: updated refs/heads/4.5 to 3736d94

Posted by ta...@apache.org.
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/588e7dc8/test/integration/component/test_vpc.py
----------------------------------------------------------------------
diff --git a/test/integration/component/test_vpc.py b/test/integration/component/test_vpc.py
index 13f0eff..58960a9 100644
--- a/test/integration/component/test_vpc.py
+++ b/test/integration/component/test_vpc.py
@@ -17,159 +17,178 @@
 
 """ Component tests for VPC functionality
 """
-#Import Local Modules
+# Import Local Modules
 from nose.plugins.attrib import attr
-from marvin.cloudstackTestCase import *
+from marvin.cloudstackTestCase import cloudstackTestCase
 from marvin.cloudstackException import CloudstackAPIException
-from marvin.cloudstackAPI import *
-from marvin.lib.utils import *
-from marvin.lib.base import *
-from marvin.lib.common import *
+from marvin.cloudstackAPI import updateZone
+from marvin.lib.utils import cleanup_resources
+from marvin.lib.base import (Account,
+                             VPC,
+                             VpcOffering,
+                             VirtualMachine,
+                             ServiceOffering,
+                             Network,
+                             NetworkOffering,
+                             PublicIPAddress,
+                             LoadBalancerRule,
+                             Router,
+                             NetworkACL,
+                             NATRule,
+                             Zone,
+                             StaticNATRule)
+from marvin.lib.common import (get_domain,
+                               get_zone,
+                               get_template,
+                               list_configurations)
+import time
 
 
 class Services:
+
     """Test VPC services
     """
 
     def __init__(self):
         self.services = {
-                         "account": {
-                                    "email": "test@test.com",
-                                    "firstname": "Test",
-                                    "lastname": "User",
-                                    "username": "test",
-                                    # Random characters are appended for unique
-                                    # username
-                                    "password": "password",
-                                    },
-                          "domain_admin": {
-                                    "email": "domain@admin.com",
-                                    "firstname": "Domain",
-                                    "lastname": "Admin",
-                                    "username": "DoA",
-                                    # Random characters are appended for unique
-                                    # username
-                                    "password": "password",
-                                    },
-                          "service_offering": {
-                                    "name": "Tiny Instance",
-                                    "displaytext": "Tiny Instance",
-                                    "cpunumber": 1,
-                                    "cpuspeed": 100,
-                                    "memory": 128,
-                                    },
-                         "network_offering": {
-                                    "name": 'VPC Network offering',
-                                    "displaytext": 'VPC Network off',
-                                    "guestiptype": 'Isolated',
-                                    "supportedservices": 'Vpn,Dhcp,Dns,SourceNat,PortForwarding,Lb,UserData,StaticNat,NetworkACL',
-                                    "traffictype": 'GUEST',
-                                    "availability": 'Optional',
-                                    "useVpc": 'on',
-                                    "serviceProviderList": {
-                                            "Vpn": 'VpcVirtualRouter',
-                                            "Dhcp": 'VpcVirtualRouter',
-                                            "Dns": 'VpcVirtualRouter',
-                                            "SourceNat": 'VpcVirtualRouter',
-                                            "PortForwarding": 'VpcVirtualRouter',
-                                            "Lb": 'VpcVirtualRouter',
-                                            "UserData": 'VpcVirtualRouter',
-                                            "StaticNat": 'VpcVirtualRouter',
-                                            "NetworkACL": 'VpcVirtualRouter'
-                                        },
-                                },
-                         "network_offering_no_lb": {
-                                    "name": 'VPC Network offering',
-                                    "displaytext": 'VPC Network off',
-                                    "guestiptype": 'Isolated',
-                                    "supportedservices": 'Vpn,Dhcp,Dns,SourceNat,PortForwarding,UserData,StaticNat,NetworkACL',
-                                    "traffictype": 'GUEST',
-                                    "availability": 'Optional',
-                                    "useVpc": 'on',
-                                    "serviceProviderList": {
-                                            "Vpn": 'VpcVirtualRouter',
-                                            "Dhcp": 'VpcVirtualRouter',
-                                            "Dns": 'VpcVirtualRouter',
-                                            "SourceNat": 'VpcVirtualRouter',
-                                            "PortForwarding": 'VpcVirtualRouter',
-                                            "UserData": 'VpcVirtualRouter',
-                                            "StaticNat": 'VpcVirtualRouter',
-                                            "NetworkACL": 'VpcVirtualRouter'
-                                        },
-                                },
-                         "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'
-                                 },
-                         "vpc_no_name": {
-                                 "displaytext": "TestVPC",
-                                 "cidr": '10.0.0.1/24'
-                                 },
-                         "network": {
-                                  "name": "Test Network",
-                                  "displaytext": "Test Network",
-                                  "netmask": '255.255.255.0'
-                                },
-                         "lbrule": {
-                                    "name": "SSH",
-                                    "alg": "leastconn",
-                                    # Algorithm used for load balancing
-                                    "privateport": 22,
-                                    "publicport": 2222,
-                                    "openfirewall": False,
-                                    "startport": 22,
-                                    "endport": 2222,
-                                    "protocol": "TCP",
-                                    "cidrlist": '0.0.0.0/0',
-                                },
-                         "natrule": {
-                                    "privateport": 22,
-                                    "publicport": 22,
-                                    "startport": 22,
-                                    "endport": 22,
-                                    "protocol": "TCP",
-                                    "cidrlist": '0.0.0.0/0',
-                                },
-                         "fw_rule": {
-                                    "startport": 1,
-                                    "endport": 6000,
-                                    "cidr": '0.0.0.0/0',
-                                    # Any network (For creating FW rule)
-                                    "protocol": "TCP"
-                                },
-                         "icmp_rule": {
-                                    "icmptype": -1,
-                                    "icmpcode": -1,
-                                    "cidrlist": '0.0.0.0/0',
-                                    "protocol": "ICMP"
-                                },
-                         "virtual_machine": {
-                                    "displayname": "Test VM",
-                                    "username": "root",
-                                    "password": "password",
-                                    "ssh_port": 22,
-                                    "hypervisor": 'XenServer',
-                                    # Hypervisor type should be same as
-                                    # hypervisor type of cluster
-                                    "privateport": 22,
-                                    "publicport": 22,
-                                    "protocol": 'TCP',
-                                },
-                        "domain": {
-                                    "name": "TestDomain"
-                                },
-                         "ostype": 'CentOS 5.3 (64-bit)',
-                         # Cent OS 5.3 (64 bit)
-                         "sleep": 60,
-                         "timeout": 10,
-                         "mode": 'advanced'
-                    }
+            "account": {
+                "email": "test@test.com",
+                "firstname": "Test",
+                "lastname": "User",
+                "username": "test",
+                # Random characters are appended for unique
+                # username
+                "password": "password",
+            },
+            "domain_admin": {
+                "email": "domain@admin.com",
+                "firstname": "Domain",
+                "lastname": "Admin",
+                "username": "DoA",
+                # Random characters are appended for unique
+                # username
+                "password": "password",
+            },
+            "service_offering": {
+                "name": "Tiny Instance",
+                "displaytext": "Tiny Instance",
+                "cpunumber": 1,
+                "cpuspeed": 100,
+                "memory": 128,
+            },
+            "network_offering": {
+                "name": 'VPC Network offering',
+                "displaytext": 'VPC Network off',
+                "guestiptype": 'Isolated',
+                "supportedservices": 'Vpn,Dhcp,Dns,SourceNat,PortForwarding,Lb,UserData,StaticNat,NetworkACL',
+                "traffictype": 'GUEST',
+                "availability": 'Optional',
+                "useVpc": 'on',
+                "serviceProviderList": {
+                    "Vpn": 'VpcVirtualRouter',
+                    "Dhcp": 'VpcVirtualRouter',
+                    "Dns": 'VpcVirtualRouter',
+                    "SourceNat": 'VpcVirtualRouter',
+                    "PortForwarding": 'VpcVirtualRouter',
+                    "Lb": 'VpcVirtualRouter',
+                    "UserData": 'VpcVirtualRouter',
+                    "StaticNat": 'VpcVirtualRouter',
+                    "NetworkACL": 'VpcVirtualRouter'
+                },
+            },
+            "network_offering_no_lb": {
+                "name": 'VPC Network offering',
+                "displaytext": 'VPC Network off',
+                "guestiptype": 'Isolated',
+                "supportedservices": 'Vpn,Dhcp,Dns,SourceNat,PortForwarding,UserData,StaticNat,NetworkACL',
+                "traffictype": 'GUEST',
+                "availability": 'Optional',
+                "useVpc": 'on',
+                "serviceProviderList": {
+                    "Vpn": 'VpcVirtualRouter',
+                    "Dhcp": 'VpcVirtualRouter',
+                    "Dns": 'VpcVirtualRouter',
+                    "SourceNat": 'VpcVirtualRouter',
+                    "PortForwarding": 'VpcVirtualRouter',
+                    "UserData": 'VpcVirtualRouter',
+                    "StaticNat": 'VpcVirtualRouter',
+                    "NetworkACL": 'VpcVirtualRouter'
+                },
+            },
+            "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'
+            },
+            "vpc_no_name": {
+                "displaytext": "TestVPC",
+                "cidr": '10.0.0.1/24'
+            },
+            "network": {
+                "name": "Test Network",
+                "displaytext": "Test Network",
+                "netmask": '255.255.255.0'
+            },
+            "lbrule": {
+                "name": "SSH",
+                "alg": "leastconn",
+                # Algorithm used for load balancing
+                "privateport": 22,
+                "publicport": 2222,
+                "openfirewall": False,
+                "startport": 22,
+                "endport": 2222,
+                "protocol": "TCP",
+                "cidrlist": '0.0.0.0/0',
+            },
+            "natrule": {
+                "privateport": 22,
+                "publicport": 22,
+                "startport": 22,
+                "endport": 22,
+                "protocol": "TCP",
+                "cidrlist": '0.0.0.0/0',
+            },
+            "fw_rule": {
+                "startport": 1,
+                "endport": 6000,
+                "cidr": '0.0.0.0/0',
+                # Any network (For creating FW rule)
+                "protocol": "TCP"
+            },
+            "icmp_rule": {
+                "icmptype": -1,
+                "icmpcode": -1,
+                "cidrlist": '0.0.0.0/0',
+                "protocol": "ICMP"
+            },
+            "virtual_machine": {
+                "displayname": "Test VM",
+                "username": "root",
+                "password": "password",
+                "ssh_port": 22,
+                "hypervisor": 'XenServer',
+                # Hypervisor type should be same as
+                # hypervisor type of cluster
+                "privateport": 22,
+                "publicport": 22,
+                "protocol": 'TCP',
+            },
+            "domain": {
+                "name": "TestDomain"
+            },
+            "ostype": 'CentOS 5.3 (64-bit)',
+            # Cent OS 5.3 (64 bit)
+            "sleep": 60,
+            "timeout": 10,
+            "mode": 'advanced'
+        }
+
 
 class TestVPC(cloudstackTestCase):
 
@@ -183,31 +202,31 @@ class TestVPC(cloudstackTestCase):
         cls.domain = get_domain(cls.api_client)
         cls.zone = get_zone(cls.api_client, cls.testClient.getZoneForTests())
         cls.template = get_template(
-                            cls.api_client,
-                            cls.zone.id,
-                            cls.services["ostype"]
-                            )
+            cls.api_client,
+            cls.zone.id,
+            cls.services["ostype"]
+        )
         cls.services["virtual_machine"]["zoneid"] = cls.zone.id
         cls.services["virtual_machine"]["template"] = cls.template.id
 
         cls.service_offering = ServiceOffering.create(
-                                            cls.api_client,
-                                            cls.services["service_offering"]
-                                            )
+            cls.api_client,
+            cls.services["service_offering"]
+        )
         cls.vpc_off = VpcOffering.create(
-                                     cls.api_client,
-                                     cls.services["vpc_offering"]
-                                     )
+            cls.api_client,
+            cls.services["vpc_offering"]
+        )
         cls.vpc_off.update(cls.api_client, state='Enabled')
         cls._cleanup = [
-                        cls.service_offering,
-                        ]
+            cls.service_offering,
+        ]
         return
 
     @classmethod
     def tearDownClass(cls):
         try:
-            #Cleanup resources used
+            # Cleanup resources used
             cleanup_resources(cls.api_client, cls._cleanup)
         except Exception as e:
             raise Exception("Warning: Exception during cleanup : %s" % e)
@@ -217,11 +236,11 @@ class TestVPC(cloudstackTestCase):
         self.apiclient = self.testClient.getApiClient()
         self.dbclient = self.testClient.getDbConnection()
         self.account = Account.create(
-                                     self.apiclient,
-                                     self.services["account"],
-                                     admin=True,
-                                     domainid=self.domain.id
-                                     )
+            self.apiclient,
+            self.services["account"],
+            admin=True,
+            domainid=self.domain.id
+        )
         self.cleanup = []
         self.cleanup.insert(0, self.account)
         return
@@ -231,7 +250,6 @@ class TestVPC(cloudstackTestCase):
             cleanup_resources(self.apiclient, self.cleanup)
         except Exception as e:
             self.debug("Warning: Exception during cleanup : %s" % e)
-            #raise Exception("Warning: Exception during cleanup : %s" % e)
         return
 
     def validate_vpc_offering(self, vpc_offering):
@@ -239,22 +257,22 @@ class TestVPC(cloudstackTestCase):
 
         self.debug("Check if the VPC offering is created successfully?")
         vpc_offs = VpcOffering.list(
-                                    self.apiclient,
-                                    id=vpc_offering.id
-                                    )
+            self.apiclient,
+            id=vpc_offering.id
+        )
         self.assertEqual(
-                         isinstance(vpc_offs, list),
-                         True,
-                         "List VPC offerings should return a valid list"
-                         )
+            isinstance(vpc_offs, list),
+            True,
+            "List VPC offerings should return a valid list"
+        )
         self.assertEqual(
-                 vpc_offering.name,
-                 vpc_offs[0].name,
-                "Name of the VPC offering should match with listVPCOff data"
-                )
+            vpc_offering.name,
+            vpc_offs[0].name,
+            "Name of the VPC offering should match with listVPCOff data"
+        )
         self.debug(
-                "VPC offering is created successfully - %s" %
-                                                        vpc_offering.name)
+            "VPC offering is created successfully - %s" %
+            vpc_offering.name)
         return
 
     def validate_vpc_network(self, network, state=None):
@@ -262,29 +280,30 @@ class TestVPC(cloudstackTestCase):
 
         self.debug("Check if the VPC network is created successfully?")
         vpc_networks = VPC.list(
-                                    self.apiclient,
-                                    id=network.id
-                          )
+            self.apiclient,
+            id=network.id
+        )
         self.assertEqual(
-                         isinstance(vpc_networks, list),
-                         True,
-                         "List VPC network should return a valid list"
-                         )
+            isinstance(vpc_networks, list),
+            True,
+            "List VPC network should return a valid list"
+        )
         self.assertEqual(
-                 network.name,
-                 vpc_networks[0].name,
-                "Name of the VPC network should match with listVPC data"
-                )
+            network.name,
+            vpc_networks[0].name,
+            "Name of the VPC network should match with listVPC data"
+        )
         if state:
             self.assertEqual(
-                 vpc_networks[0].state,
-                 state,
+                vpc_networks[0].state,
+                state,
                 "VPC state should be '%s'" % state
-                )
+            )
         self.debug("VPC network validated - %s" % network.name)
         return
 
-    #list_vpc_apis should be the first case otherwise the vpc counts would be wrong
+    # list_vpc_apis should be the first case otherwise the vpc counts would be
+    # wrong
     @attr(tags=["advanced", "intervlan"], required_hardware="false")
     def test_01_list_vpc_apis(self):
         """ Test list VPC APIs
@@ -306,162 +325,161 @@ class TestVPC(cloudstackTestCase):
 
         self.services["vpc"]["cidr"] = "10.1.1.1/16"
         self.debug("creating a VPC network in the account: %s" %
-                                                    self.account.name)
+                   self.account.name)
         vpc_1 = VPC.create(
-                         self.apiclient,
-                         self.services["vpc"],
-                         vpcofferingid=self.vpc_off.id,
-                         zoneid=self.zone.id,
-                         account=self.account.name,
-                         domainid=self.account.domainid
-                         )
+            self.apiclient,
+            self.services["vpc"],
+            vpcofferingid=self.vpc_off.id,
+            zoneid=self.zone.id,
+            account=self.account.name,
+            domainid=self.account.domainid
+        )
         self.validate_vpc_network(vpc_1)
 
         self.services["vpc"]["cidr"] = "10.1.46.1/16"
         vpc_2 = VPC.create(
-                         self.apiclient,
-                         self.services["vpc"],
-                         vpcofferingid=self.vpc_off.id,
-                         zoneid=self.zone.id,
-                         account=self.account.name,
-                         domainid=self.account.domainid
-                         )
+            self.apiclient,
+            self.services["vpc"],
+            vpcofferingid=self.vpc_off.id,
+            zoneid=self.zone.id,
+            account=self.account.name,
+            domainid=self.account.domainid
+        )
         self.validate_vpc_network(vpc_2)
 
         self.debug("Check list VPC API by Name?")
         vpcs = VPC.list(
-                        self.apiclient,
-                        name=vpc_1.name,
-                        listall=True
-                        )
+            self.apiclient,
+            name=vpc_1.name,
+            listall=True
+        )
         self.assertEqual(
-                        isinstance(vpcs, list),
-                        True,
-                        "List VPC shall return a valid resposne"
-                        )
+            isinstance(vpcs, list),
+            True,
+            "List VPC shall return a valid resposne"
+        )
         vpc = vpcs[0]
         self.assertEqual(
-                         vpc.name,
-                         vpc_1.name,
-                         "VPC name should match with the existing one"
-                         )
+            vpc.name,
+            vpc_1.name,
+            "VPC name should match with the existing one"
+        )
 
         self.debug("Check list VPC API by displayText?")
         vpcs = VPC.list(
-                        self.apiclient,
-                        displaytext=vpc_1.displaytext,
-                        listall=True
-                        )
+            self.apiclient,
+            displaytext=vpc_1.displaytext,
+            listall=True
+        )
         self.assertEqual(
-                        isinstance(vpcs, list),
-                        True,
-                        "List VPC shall return a valid resposne"
-                        )
+            isinstance(vpcs, list),
+            True,
+            "List VPC shall return a valid resposne"
+        )
         vpc = vpcs[0]
         self.assertEqual(
-                         vpc.displaytext,
-                         vpc_1.displaytext,
-                         "VPC displaytext should match with the existing one"
-                         )
+            vpc.displaytext,
+            vpc_1.displaytext,
+            "VPC displaytext should match with the existing one"
+        )
 
         self.debug("Check list VPC API by cidr?")
         vpcs = VPC.list(
-                        self.apiclient,
-                        cidr=vpc_2.cidr,
-                        listall=True
-                        )
+            self.apiclient,
+            cidr=vpc_2.cidr,
+            listall=True
+        )
         self.assertEqual(
-                        isinstance(vpcs, list),
-                        True,
-                        "List VPC shall return a valid resposne"
-                        )
+            isinstance(vpcs, list),
+            True,
+            "List VPC shall return a valid resposne"
+        )
         vpc = vpcs[0]
         self.assertEqual(
-                         vpc.cidr,
-                         vpc_2.cidr,
-                         "VPC cidr should match with the existing one"
-                         )
+            vpc.cidr,
+            vpc_2.cidr,
+            "VPC cidr should match with the existing one"
+        )
         self.debug("Validating list VPC by Id")
         self.validate_vpc_network(vpc_1)
 
         self.debug("Validating list VPC by vpcofferingId")
         vpcs = VPC.list(
-                        self.apiclient,
-                        vpcofferingid=self.vpc_off.id,
-                        listall=True
-                        )
+            self.apiclient,
+            vpcofferingid=self.vpc_off.id,
+            listall=True
+        )
         self.assertEqual(
-                        isinstance(vpcs, list),
-                        True,
-                        "List VPC by vpcofferingId should return a valid response"
-                    )
+            isinstance(vpcs, list),
+            True,
+            "List VPC by vpcofferingId should return a valid response"
+        )
         self.debug("Length of list VPC response: %s" % len(vpcs))
         self.assertEqual(
-                        len(vpcs),
-                        2,
-                        "List VPC should return 2 enabled VPCs"
-                        )
+            len(vpcs),
+            2,
+            "List VPC should return 2 enabled VPCs"
+        )
         for vpc in vpcs:
             self.assertEqual(
-                            vpc.vpcofferingid,
-                            self.vpc_off.id,
-                            "VPC offering ID should match with that of resposne"
-                            )
+                vpc.vpcofferingid,
+                self.vpc_off.id,
+                "VPC offering ID should match with that of resposne"
+            )
 
         self.debug("Validating list VPC by supportedservices")
         vpcs = VPC.list(
-                        self.apiclient,
-                        supportedservices='Vpn,Dhcp,Dns,SourceNat,PortForwarding,Lb,UserData,StaticNat,NetworkACL',
-                        listall=True,
-                        account=self.account.name,
-                        domainid=self.account.domainid
-                        )
+            self.apiclient,
+            supportedservices='Vpn,Dhcp,Dns,SourceNat,PortForwarding,Lb,UserData,StaticNat,NetworkACL',
+            listall=True,
+            account=self.account.name,
+            domainid=self.account.domainid)
         self.assertEqual(
-                        isinstance(vpcs, list),
-                        True,
-                        "List VPC by vpcofferingId should return a valid response"
-                    )
+            isinstance(vpcs, list),
+            True,
+            "List VPC by vpcofferingId should return a valid response"
+        )
         for vpc in vpcs:
             self.assertIn(
-                            vpc.id,
-                            [vpc_1.id, vpc_2.id],
-                            "VPC offering ID should match with that of resposne"
-                            )
+                vpc.id,
+                [vpc_1.id, vpc_2.id],
+                "VPC offering ID should match with that of resposne"
+            )
         self.debug("Validating list VPC by restart required")
         vpcs = VPC.list(
-                        self.apiclient,
-                        restartrequired=True,
-                        listall=True,
-                        account=self.account.name,
-                        domainid=self.account.domainid
-                        )
+            self.apiclient,
+            restartrequired=True,
+            listall=True,
+            account=self.account.name,
+            domainid=self.account.domainid
+        )
         if vpcs is not None:
             for vpc in vpcs:
                 self.assertEqual(
-                            vpc.restartrequired,
-                            True,
-                            "RestartRequired should be set as True"
-                            )
+                    vpc.restartrequired,
+                    True,
+                    "RestartRequired should be set as True"
+                )
         self.debug("Validating list VPC by restart required")
         vpcs = VPC.list(
-                        self.apiclient,
-                        restartrequired=False,
-                        listall=True,
-                        account=self.account.name,
-                        domainid=self.account.domainid
-                        )
+            self.apiclient,
+            restartrequired=False,
+            listall=True,
+            account=self.account.name,
+            domainid=self.account.domainid
+        )
         self.assertEqual(
-                        isinstance(vpcs, list),
-                        True,
-                        "List VPC by vpcofferingId should return a valid response"
-                    )
+            isinstance(vpcs, list),
+            True,
+            "List VPC by vpcofferingId should return a valid response"
+        )
         if vpcs is not None:
             for vpc in vpcs:
                 self.assertEqual(
-                            vpc.restartrequired,
-                            False,
-                            "RestartRequired should be set as False"
-                            )
+                    vpc.restartrequired,
+                    False,
+                    "RestartRequired should be set as False"
+                )
         return
 
     @attr(tags=["advanced", "intervlan"], required_hardware="false")
@@ -475,15 +493,15 @@ class TestVPC(cloudstackTestCase):
 
         self.services["vpc"]["cidr"] = "10.1.1.1/16"
         self.debug("creating a VPC network in the account: %s" %
-                                                    self.account.name)
+                   self.account.name)
         vpc = VPC.create(
-                         self.apiclient,
-                         self.services["vpc"],
-                         vpcofferingid=self.vpc_off.id,
-                         zoneid=self.zone.id,
-                         account=self.account.name,
-                         domainid=self.account.domainid
-                         )
+            self.apiclient,
+            self.services["vpc"],
+            vpcofferingid=self.vpc_off.id,
+            zoneid=self.zone.id,
+            account=self.account.name,
+            domainid=self.account.domainid
+        )
         self.validate_vpc_network(vpc)
 
         self.debug("Restarting the VPC with no network")
@@ -507,22 +525,22 @@ class TestVPC(cloudstackTestCase):
 
         self.services["vpc"]["cidr"] = "10.1.1.1/16"
         self.debug("creating a VPC network in the account: %s" %
-                                                    self.account.name)
+                   self.account.name)
         vpc = VPC.create(
-                         self.apiclient,
-                         self.services["vpc"],
-                         vpcofferingid=self.vpc_off.id,
-                         zoneid=self.zone.id,
-                         account=self.account.name,
-                         domainid=self.account.domainid
-                         )
+            self.apiclient,
+            self.services["vpc"],
+            vpcofferingid=self.vpc_off.id,
+            zoneid=self.zone.id,
+            account=self.account.name,
+            domainid=self.account.domainid
+        )
         self.validate_vpc_network(vpc)
 
         self.network_offering = NetworkOffering.create(
-                                            self.apiclient,
-                                            self.services["network_offering"],
-                                            conservemode=False
-                                            )
+            self.apiclient,
+            self.services["network_offering"],
+            conservemode=False
+        )
         # Enable Network offering
         self.network_offering.update(self.apiclient, state='Enabled')
         self.cleanup.append(self.network_offering)
@@ -534,41 +552,41 @@ class TestVPC(cloudstackTestCase):
 
         # Creating network using the network offering created
         self.debug("Creating network with network offering: %s" %
-                                                    self.network_offering.id)
+                   self.network_offering.id)
         network_1 = Network.create(
-                                self.apiclient,
-                                self.services["network"],
-                                accountid=self.account.name,
-                                domainid=self.account.domainid,
-                                networkofferingid=self.network_offering.id,
-                                zoneid=self.zone.id,
-                                gateway=gateway,
-                                vpcid=vpc.id
-                                )
+            self.apiclient,
+            self.services["network"],
+            accountid=self.account.name,
+            domainid=self.account.domainid,
+            networkofferingid=self.network_offering.id,
+            zoneid=self.zone.id,
+            gateway=gateway,
+            vpcid=vpc.id
+        )
         self.debug("Created network with ID: %s" % network_1.id)
 
         self.network_offering_no_lb = NetworkOffering.create(
-                                    self.apiclient,
-                                    self.services["network_offering_no_lb"],
-                                    conservemode=False
-                                    )
+            self.apiclient,
+            self.services["network_offering_no_lb"],
+            conservemode=False
+        )
         # Enable Network offering
         self.network_offering_no_lb.update(self.apiclient, state='Enabled')
         self.cleanup.append(self.network_offering_no_lb)
 
         gateway = '10.1.2.1'    # New network -> different gateway
         self.debug("Creating network with network offering: %s" %
-                                            self.network_offering_no_lb.id)
+                   self.network_offering_no_lb.id)
         network_2 = Network.create(
-                            self.apiclient,
-                            self.services["network"],
-                            accountid=self.account.name,
-                            domainid=self.account.domainid,
-                            networkofferingid=self.network_offering_no_lb.id,
-                            zoneid=self.zone.id,
-                            gateway=gateway,
-                            vpcid=vpc.id
-                            )
+            self.apiclient,
+            self.services["network"],
+            accountid=self.account.name,
+            domainid=self.account.domainid,
+            networkofferingid=self.network_offering_no_lb.id,
+            zoneid=self.zone.id,
+            gateway=gateway,
+            vpcid=vpc.id
+        )
         self.debug("Created network with ID: %s" % network_2.id)
 
         self.debug("Restarting the VPC with no network")
@@ -591,15 +609,15 @@ class TestVPC(cloudstackTestCase):
 
         self.services["vpc"]["cidr"] = "10.1.1.1/16"
         self.debug("creating a VPC network in the account: %s" %
-                                                    self.account.name)
+                   self.account.name)
         vpc = VPC.create(
-                         self.apiclient,
-                         self.services["vpc"],
-                         vpcofferingid=self.vpc_off.id,
-                         zoneid=self.zone.id,
-                         account=self.account.name,
-                         domainid=self.account.domainid
-                         )
+            self.apiclient,
+            self.services["vpc"],
+            vpcofferingid=self.vpc_off.id,
+            zoneid=self.zone.id,
+            account=self.account.name,
+            domainid=self.account.domainid
+        )
         self.validate_vpc_network(vpc)
 
         self.debug("Restarting the VPC with no network")
@@ -610,14 +628,14 @@ class TestVPC(cloudstackTestCase):
 
         self.debug("Check if the VPC offering is deleted successfully?")
         vpcs = VPC.list(
-                                    self.apiclient,
-                                    id=vpc.id
-                                    )
+            self.apiclient,
+            id=vpc.id
+        )
         self.assertEqual(
-                         vpcs,
-                         None,
-                         "List VPC offerings should not return anything"
-                         )
+            vpcs,
+            None,
+            "List VPC offerings should not return anything"
+        )
         return
 
     @attr(tags=["advanced", "intervlan"], required_hardware="false")
@@ -634,22 +652,22 @@ class TestVPC(cloudstackTestCase):
 
         self.services["vpc"]["cidr"] = "10.1.1.1/16"
         self.debug("creating a VPC network in the account: %s" %
-                                                    self.account.name)
+                   self.account.name)
         vpc = VPC.create(
-                         self.apiclient,
-                         self.services["vpc"],
-                         vpcofferingid=self.vpc_off.id,
-                         zoneid=self.zone.id,
-                         account=self.account.name,
-                         domainid=self.account.domainid
-                         )
+            self.apiclient,
+            self.services["vpc"],
+            vpcofferingid=self.vpc_off.id,
+            zoneid=self.zone.id,
+            account=self.account.name,
+            domainid=self.account.domainid
+        )
         self.validate_vpc_network(vpc)
 
         self.network_offering = NetworkOffering.create(
-                                            self.apiclient,
-                                            self.services["network_offering"],
-                                            conservemode=False
-                                            )
+            self.apiclient,
+            self.services["network_offering"],
+            conservemode=False
+        )
         # Enable Network offering
         self.network_offering.update(self.apiclient, state='Enabled')
         self.cleanup.append(self.network_offering)
@@ -661,41 +679,41 @@ class TestVPC(cloudstackTestCase):
 
         # Creating network using the network offering created
         self.debug("Creating network with network offering: %s" %
-                                                    self.network_offering.id)
+                   self.network_offering.id)
         network_1 = Network.create(
-                                self.apiclient,
-                                self.services["network"],
-                                accountid=self.account.name,
-                                domainid=self.account.domainid,
-                                networkofferingid=self.network_offering.id,
-                                zoneid=self.zone.id,
-                                gateway=gateway,
-                                vpcid=vpc.id
-                                )
+            self.apiclient,
+            self.services["network"],
+            accountid=self.account.name,
+            domainid=self.account.domainid,
+            networkofferingid=self.network_offering.id,
+            zoneid=self.zone.id,
+            gateway=gateway,
+            vpcid=vpc.id
+        )
         self.debug("Created network with ID: %s" % network_1.id)
 
         self.network_offering_no_lb = NetworkOffering.create(
-                                            self.apiclient,
-                                            self.services["network_offering_no_lb"],
-                                            conservemode=False
-                                            )
+            self.apiclient,
+            self.services["network_offering_no_lb"],
+            conservemode=False
+        )
         # Enable Network offering
         self.network_offering_no_lb.update(self.apiclient, state='Enabled')
         self.cleanup.append(self.network_offering_no_lb)
 
         gateway = '10.1.2.1'    # New network -> different gateway
         self.debug("Creating network with network offering: %s" %
-                                                    self.network_offering_no_lb.id)
+                   self.network_offering_no_lb.id)
         network_2 = Network.create(
-                                self.apiclient,
-                                self.services["network"],
-                                accountid=self.account.name,
-                                domainid=self.account.domainid,
-                                networkofferingid=self.network_offering_no_lb.id,
-                                zoneid=self.zone.id,
-                                gateway=gateway,
-                                vpcid=vpc.id
-                                )
+            self.apiclient,
+            self.services["network"],
+            accountid=self.account.name,
+            domainid=self.account.domainid,
+            networkofferingid=self.network_offering_no_lb.id,
+            zoneid=self.zone.id,
+            gateway=gateway,
+            vpcid=vpc.id
+        )
         self.debug("Created network with ID: %s" % network_2.id)
 
         self.debug("Deleting the VPC with no network")
@@ -718,37 +736,38 @@ class TestVPC(cloudstackTestCase):
 
         self.debug("Check if the VPC offering is deleted successfully?")
         vpcs = VPC.list(
-                        self.apiclient,
-                        id=vpc.id
-                        )
+            self.apiclient,
+            id=vpc.id
+        )
         self.assertEqual(
-                         vpcs,
-                         None,
-                         "List VPC offerings should not return anything"
-                         )
-        self.debug("Waiting for network.gc.interval to cleanup network resources")
+            vpcs,
+            None,
+            "List VPC offerings should not return anything"
+        )
+        self.debug(
+            "Waiting for network.gc.interval to cleanup network resources")
         interval = list_configurations(
-                                    self.apiclient,
-                                    name='network.gc.interval'
-                                    )
+            self.apiclient,
+            name='network.gc.interval'
+        )
         wait = list_configurations(
-                                    self.apiclient,
-                                    name='network.gc.wait'
-                                   )
+            self.apiclient,
+            name='network.gc.wait'
+        )
         # Sleep to ensure that all resources are deleted
         time.sleep(int(interval[0].value) + int(wait[0].value))
         self.debug("Check if VR is deleted or not?")
         routers = Router.list(
-                            self.apiclient,
-                            account=self.account.name,
-                            domainid=self.account.domainid,
-                            listall=True
-                            )
+            self.apiclient,
+            account=self.account.name,
+            domainid=self.account.domainid,
+            listall=True
+        )
         self.assertEqual(
-                        routers,
-                        None,
-                        "List Routers for the account should not return any response"
-                        )
+            routers,
+            None,
+            "List Routers for the account should not return any response"
+        )
         return
 
     @attr(tags=["advanced", "intervlan"], required_hardware="false")
@@ -762,53 +781,53 @@ class TestVPC(cloudstackTestCase):
         # 3. list VPCS as domain admin User to view all the Vpcs owned by admin
 
         self.user = Account.create(
-                                     self.apiclient,
-                                     self.services["account"],
-                                )
+            self.apiclient,
+            self.services["account"],
+        )
         self.cleanup.append(self.user)
 
         self.services["vpc"]["cidr"] = "10.1.1.1/16"
         self.debug("creating a VPC network in the account: %s" %
-                                                    self.account.name)
+                   self.account.name)
         vpc_1 = VPC.create(
-                         self.apiclient,
-                         self.services["vpc"],
-                         vpcofferingid=self.vpc_off.id,
-                         zoneid=self.zone.id,
-                         account=self.account.name,
-                         domainid=self.account.domainid
-                         )
+            self.apiclient,
+            self.services["vpc"],
+            vpcofferingid=self.vpc_off.id,
+            zoneid=self.zone.id,
+            account=self.account.name,
+            domainid=self.account.domainid
+        )
         self.validate_vpc_network(vpc_1)
 
         self.services["vpc"]["cidr"] = "10.1.46.1/16"
         vpc_2 = VPC.create(
-                         self.apiclient,
-                         self.services["vpc"],
-                         vpcofferingid=self.vpc_off.id,
-                         zoneid=self.zone.id,
-                         account=self.user.name,
-                         domainid=self.user.domainid
-                         )
+            self.apiclient,
+            self.services["vpc"],
+            vpcofferingid=self.vpc_off.id,
+            zoneid=self.zone.id,
+            account=self.user.name,
+            domainid=self.user.domainid
+        )
         self.validate_vpc_network(vpc_2)
 
         self.debug("Validating list VPCs call by passing account and domain")
         vpcs = VPC.list(
-                        self.apiclient,
-                        account=self.user.name,
-                        domainid=self.user.domainid,
-                        listall=True
-                    )
+            self.apiclient,
+            account=self.user.name,
+            domainid=self.user.domainid,
+            listall=True
+        )
         self.assertEqual(
-                    isinstance(vpcs, list),
-                    True,
-                    "List VPC should return a valid response"
-                )
+            isinstance(vpcs, list),
+            True,
+            "List VPC should return a valid response"
+        )
         vpc = vpcs[0]
         self.assertEqual(
-                        vpc.id,
-                        vpc_2.id,
-                        "List VPC should return VPC belonging to that account"
-                        )
+            vpc.id,
+            vpc_2.id,
+            "List VPC should return VPC belonging to that account"
+        )
         return
 
     @attr(tags=["advanced", "intervlan", "multiple"], required_hardware="true")
@@ -837,9 +856,9 @@ class TestVPC(cloudstackTestCase):
 
         self.debug("Creating a VPC offering..")
         vpc_off = VpcOffering.create(
-                                     self.apiclient,
-                                     self.services["vpc_offering"]
-                                     )
+            self.apiclient,
+            self.services["vpc_offering"]
+        )
 
         self.cleanup.append(vpc_off)
         self.validate_vpc_offering(vpc_off)
@@ -848,249 +867,250 @@ class TestVPC(cloudstackTestCase):
         vpc_off.update(self.apiclient, state='Enabled')
 
         self.debug("creating a VPC network in the account: %s" %
-                                                    self.account.name)
+                   self.account.name)
         self.services["vpc"]["cidr"] = '10.1.1.1/16'
         vpc = VPC.create(
-                         self.apiclient,
-                         self.services["vpc"],
-                         vpcofferingid=vpc_off.id,
-                         zoneid=self.zone.id,
-                         account=self.account.name,
-                         domainid=self.account.domainid
-                         )
+            self.apiclient,
+            self.services["vpc"],
+            vpcofferingid=vpc_off.id,
+            zoneid=self.zone.id,
+            account=self.account.name,
+            domainid=self.account.domainid
+        )
         self.validate_vpc_network(vpc)
 
         self.network_offering = NetworkOffering.create(
-                                            self.apiclient,
-                                            self.services["network_offering"],
-                                            conservemode=False
-                                            )
+            self.apiclient,
+            self.services["network_offering"],
+            conservemode=False
+        )
         # Enable Network offering
         self.network_offering.update(self.apiclient, state='Enabled')
         self.cleanup.append(self.network_offering)
 
         self.network_offering_no_lb = NetworkOffering.create(
-                                    self.apiclient,
-                                    self.services["network_offering_no_lb"],
-                                    conservemode=False
-                                    )
+            self.apiclient,
+            self.services["network_offering_no_lb"],
+            conservemode=False
+        )
         # Enable Network offering
         self.network_offering_no_lb.update(self.apiclient, state='Enabled')
         self.cleanup.append(self.network_offering_no_lb)
 
         # Creating network using the network offering created
         self.debug("Creating network with network offering: %s" %
-                                                    self.network_offering_no_lb.id)
+                   self.network_offering_no_lb.id)
         network_1 = Network.create(
-                                self.apiclient,
-                                self.services["network"],
-                                accountid=self.account.name,
-                                domainid=self.account.domainid,
-                                networkofferingid=self.network_offering_no_lb.id,
-                                zoneid=self.zone.id,
-                                gateway='10.1.1.1',
-                                vpcid=vpc.id
-                                )
+            self.apiclient,
+            self.services["network"],
+            accountid=self.account.name,
+            domainid=self.account.domainid,
+            networkofferingid=self.network_offering_no_lb.id,
+            zoneid=self.zone.id,
+            gateway='10.1.1.1',
+            vpcid=vpc.id
+        )
         self.debug("Created network with ID: %s" % network_1.id)
 
         # Creating network using the network offering created
         self.debug("Creating network with network offering: %s" %
-                                                    self.network_offering.id)
+                   self.network_offering.id)
         network_2 = Network.create(
-                                self.apiclient,
-                                self.services["network"],
-                                accountid=self.account.name,
-                                domainid=self.account.domainid,
-                                networkofferingid=self.network_offering.id,
-                                zoneid=self.zone.id,
-                                gateway='10.1.2.1',
-                                vpcid=vpc.id
-                                )
+            self.apiclient,
+            self.services["network"],
+            accountid=self.account.name,
+            domainid=self.account.domainid,
+            networkofferingid=self.network_offering.id,
+            zoneid=self.zone.id,
+            gateway='10.1.2.1',
+            vpcid=vpc.id
+        )
         self.debug("Created network with ID: %s" % network_2.id)
 
         self.debug("deploying VMs in network: %s" % network_1.name)
         # Spawn an instance in that network
         vm_1 = VirtualMachine.create(
-                                  self.apiclient,
-                                  self.services["virtual_machine"],
-                                  accountid=self.account.name,
-                                  domainid=self.account.domainid,
-                                  serviceofferingid=self.service_offering.id,
-                                  networkids=[str(network_1.id)]
-                                  )
+            self.apiclient,
+            self.services["virtual_machine"],
+            accountid=self.account.name,
+            domainid=self.account.domainid,
+            serviceofferingid=self.service_offering.id,
+            networkids=[str(network_1.id)]
+        )
         self.debug("Deployed VM in network: %s" % network_1.id)
 
         vm_2 = VirtualMachine.create(
-                                  self.apiclient,
-                                  self.services["virtual_machine"],
-                                  accountid=self.account.name,
-                                  domainid=self.account.domainid,
-                                  serviceofferingid=self.service_offering.id,
-                                  networkids=[str(network_1.id)]
-                                  )
+            self.apiclient,
+            self.services["virtual_machine"],
+            accountid=self.account.name,
+            domainid=self.account.domainid,
+            serviceofferingid=self.service_offering.id,
+            networkids=[str(network_1.id)]
+        )
         self.debug("Deployed VM in network: %s" % network_1.id)
 
         self.debug("deploying VMs in network: %s" % network_2.name)
         # Spawn an instance in that network
         vm_3 = VirtualMachine.create(
-                                  self.apiclient,
-                                  self.services["virtual_machine"],
-                                  accountid=self.account.name,
-                                  domainid=self.account.domainid,
-                                  serviceofferingid=self.service_offering.id,
-                                  networkids=[str(network_2.id)]
-                                  )
+            self.apiclient,
+            self.services["virtual_machine"],
+            accountid=self.account.name,
+            domainid=self.account.domainid,
+            serviceofferingid=self.service_offering.id,
+            networkids=[str(network_2.id)]
+        )
         self.debug("Deployed VM in network: %s" % network_2.id)
 
         vm_4 = VirtualMachine.create(
-                                  self.apiclient,
-                                  self.services["virtual_machine"],
-                                  accountid=self.account.name,
-                                  domainid=self.account.domainid,
-                                  serviceofferingid=self.service_offering.id,
-                                  networkids=[str(network_2.id)]
-                                  )
+            self.apiclient,
+            self.services["virtual_machine"],
+            accountid=self.account.name,
+            domainid=self.account.domainid,
+            serviceofferingid=self.service_offering.id,
+            networkids=[str(network_2.id)]
+        )
         self.debug("Deployed VM in network: %s" % network_2.id)
 
         self.debug("Associating public IP for network: %s" % network_1.name)
         public_ip_1 = PublicIPAddress.create(
-                                self.apiclient,
-                                accountid=self.account.name,
-                                zoneid=self.zone.id,
-                                domainid=self.account.domainid,
-                                networkid=network_1.id,
-                                vpcid=vpc.id
-                                )
+            self.apiclient,
+            accountid=self.account.name,
+            zoneid=self.zone.id,
+            domainid=self.account.domainid,
+            networkid=network_1.id,
+            vpcid=vpc.id
+        )
         self.debug("Associated %s with network %s" % (
-                                        public_ip_1.ipaddress.ipaddress,
-                                        network_1.id
-                                        ))
-
-        nat_rule = NATRule.create(
-                                  self.apiclient,
-                                  vm_1,
-                                  self.services["natrule"],
-                                  ipaddressid=public_ip_1.ipaddress.id,
-                                  openfirewall=False,
-                                  networkid=network_1.id,
-                                  vpcid=vpc.id
-                                  )
+            public_ip_1.ipaddress.ipaddress,
+            network_1.id
+        ))
+
+        NATRule.create(
+            self.apiclient,
+            vm_1,
+            self.services["natrule"],
+            ipaddressid=public_ip_1.ipaddress.id,
+            openfirewall=False,
+            networkid=network_1.id,
+            vpcid=vpc.id
+        )
 
         self.debug("Adding NetwrokACl rules to make NAT rule accessible")
-        nwacl_nat = NetworkACL.create(
-                                         self.apiclient,
-                                         networkid=network_1.id,
-                                         services=self.services["natrule"],
-                                         traffictype='Ingress'
-                                         )
+        NetworkACL.create(
+            self.apiclient,
+            networkid=network_1.id,
+            services=self.services["natrule"],
+            traffictype='Ingress'
+        )
 
         self.debug("Associating public IP for network: %s" % network_1.name)
         public_ip_2 = PublicIPAddress.create(
-                                self.apiclient,
-                                accountid=self.account.name,
-                                zoneid=self.zone.id,
-                                domainid=self.account.domainid,
-                                networkid=network_1.id,
-                                vpcid=vpc.id
-                                )
+            self.apiclient,
+            accountid=self.account.name,
+            zoneid=self.zone.id,
+            domainid=self.account.domainid,
+            networkid=network_1.id,
+            vpcid=vpc.id
+        )
         self.debug("Associated %s with network %s" % (
-                                        public_ip_2.ipaddress.ipaddress,
-                                        network_1.id
-                                        ))
+            public_ip_2.ipaddress.ipaddress,
+            network_1.id
+        ))
         self.debug("Enabling static NAT for IP: %s" %
-                                            public_ip_2.ipaddress.ipaddress)
+                   public_ip_2.ipaddress.ipaddress)
         try:
             StaticNATRule.enable(
-                              self.apiclient,
-                              ipaddressid=public_ip_2.ipaddress.id,
-                              virtualmachineid=vm_2.id,
-                              networkid=network_1.id
-                              )
+                self.apiclient,
+                ipaddressid=public_ip_2.ipaddress.id,
+                virtualmachineid=vm_2.id,
+                networkid=network_1.id
+            )
             self.debug("Static NAT enabled for IP: %s" %
-                                            public_ip_2.ipaddress.ipaddress)
+                       public_ip_2.ipaddress.ipaddress)
         except Exception as e:
             self.fail("Failed to enable static NAT on IP: %s - %s" % (
-                                        public_ip_2.ipaddress.ipaddress, e))
+                public_ip_2.ipaddress.ipaddress, e))
 
         public_ips = PublicIPAddress.list(
-                                    self.apiclient,
-                                    networkid=network_1.id,
-                                    listall=True,
-                                    isstaticnat=True,
-                                    account=self.account.name,
-                                    domainid=self.account.domainid
-                                  )
+            self.apiclient,
+            networkid=network_1.id,
+            listall=True,
+            isstaticnat=True,
+            account=self.account.name,
+            domainid=self.account.domainid
+        )
         self.assertEqual(
-                         isinstance(public_ips, list),
-                         True,
-                         "List public Ip for network should list the Ip addr"
-                         )
+            isinstance(public_ips, list),
+            True,
+            "List public Ip for network should list the Ip addr"
+        )
         self.assertEqual(
-                         public_ips[0].ipaddress,
-                         public_ip_2.ipaddress.ipaddress,
-                         "List public Ip for network should list the Ip addr"
-                         )
+            public_ips[0].ipaddress,
+            public_ip_2.ipaddress.ipaddress,
+            "List public Ip for network should list the Ip addr"
+        )
 
         self.debug("Associating public IP for network: %s" % vpc.name)
         public_ip_3 = PublicIPAddress.create(
-                                self.apiclient,
-                                accountid=self.account.name,
-                                zoneid=self.zone.id,
-                                domainid=self.account.domainid,
-                                networkid=network_2.id,
-                                vpcid=vpc.id
-                                )
+            self.apiclient,
+            accountid=self.account.name,
+            zoneid=self.zone.id,
+            domainid=self.account.domainid,
+            networkid=network_2.id,
+            vpcid=vpc.id
+        )
         self.debug("Associated %s with network %s" % (
-                                        public_ip_3.ipaddress.ipaddress,
-                                        network_2.id
-                                        ))
+            public_ip_3.ipaddress.ipaddress,
+            network_2.id
+        ))
 
         self.debug("Creating LB rule for IP address: %s" %
-                                        public_ip_3.ipaddress.ipaddress)
+                   public_ip_3.ipaddress.ipaddress)
 
         lb_rule = LoadBalancerRule.create(
-                                    self.apiclient,
-                                    self.services["lbrule"],
-                                    ipaddressid=public_ip_3.ipaddress.id,
-                                    accountid=self.account.name,
-                                    networkid=network_2.id,
-                                    vpcid=vpc.id,
-                                    domainid=self.account.domainid
-                                )
+            self.apiclient,
+            self.services["lbrule"],
+            ipaddressid=public_ip_3.ipaddress.id,
+            accountid=self.account.name,
+            networkid=network_2.id,
+            vpcid=vpc.id,
+            domainid=self.account.domainid
+        )
 
         self.debug("Adding virtual machines %s and %s to LB rule" % (
-                                    vm_3.name, vm_4.name))
+            vm_3.name, vm_4.name))
         lb_rule.assign(self.apiclient, [vm_3, vm_4])
 
         self.debug("Adding NetwrokACl rules to make PF and LB accessible")
-        nwacl_lb = NetworkACL.create(
-                                self.apiclient,
-                                networkid=network_2.id,
-                                services=self.services["lbrule"],
-                                traffictype='Ingress'
-                                )
-
-        self.debug("Adding Egress rules to network %s and %s to allow access to internet")
-        nwacl_internet_1 = NetworkACL.create(
-                                self.apiclient,
-                                networkid=network_1.id,
-                                services=self.services["icmp_rule"],
-                                traffictype='Egress'
-                                )
-        nwacl_internet_2 = NetworkACL.create(
-                                self.apiclient,
-                                networkid=network_2.id,
-                                services=self.services["icmp_rule"],
-                                traffictype='Egress'
-                                )
+        NetworkACL.create(
+            self.apiclient,
+            networkid=network_2.id,
+            services=self.services["lbrule"],
+            traffictype='Ingress'
+        )
+
+        self.debug("Adding Egress rules to network %s and %s to allow\
+                    access to internet")
+        NetworkACL.create(
+            self.apiclient,
+            networkid=network_1.id,
+            services=self.services["icmp_rule"],
+            traffictype='Egress'
+        )
+        NetworkACL.create(
+            self.apiclient,
+            networkid=network_2.id,
+            services=self.services["icmp_rule"],
+            traffictype='Egress'
+        )
 
         self.debug("Checking if we can SSH into VM_1?")
         try:
             ssh_1 = vm_1.get_ssh_client(
-                                ipaddress=public_ip_1.ipaddress.ipaddress,
-                                reconnect=True,
-                                port=self.services["natrule"]["publicport"]
-                                )
+                ipaddress=public_ip_1.ipaddress.ipaddress,
+                reconnect=True,
+                port=self.services["natrule"]["publicport"]
+            )
             self.debug("SSH into VM is successfully")
 
             self.debug("Verifying if we can ping to outside world from VM?")
@@ -1103,61 +1123,61 @@ class TestVPC(cloudstackTestCase):
             # rtt min/avg/max/mdev = 25.970/25.970/25.970/0.000 ms
         except Exception as e:
             self.fail("Failed to SSH into VM - %s, %s" %
-                                        (public_ip_1.ipaddress.ipaddress, e))
+                      (public_ip_1.ipaddress.ipaddress, e))
 
         result = str(res)
         self.debug("Result: %s" % result)
         self.assertEqual(
-                         result.count("1 received"),
-                         1,
-                         "Ping to outside world from VM should be successful"
-                         )
+            result.count("1 received"),
+            1,
+            "Ping to outside world from VM should be successful"
+        )
 
         self.debug("Checking if we can SSH into VM_2?")
         try:
             ssh_2 = vm_2.get_ssh_client(
-                                ipaddress=public_ip_2.ipaddress.ipaddress,
-                                reconnect=True,
-                                port=self.services["natrule"]["publicport"]
-                                )
+                ipaddress=public_ip_2.ipaddress.ipaddress,
+                reconnect=True,
+                port=self.services["natrule"]["publicport"]
+            )
             self.debug("SSH into VM is successfully")
 
             self.debug("Verifying if we can ping to outside world from VM?")
             res = ssh_2.execute("ping -c 1 www.google.com")
         except Exception as e:
             self.fail("Failed to SSH into VM - %s, %s" %
-                                        (public_ip_2.ipaddress.ipaddress, e))
+                      (public_ip_2.ipaddress.ipaddress, e))
 
         result = str(res)
         self.debug("Result: %s" % result)
         self.assertEqual(
-                         result.count("1 received"),
-                         1,
-                         "Ping to outside world from VM should be successful"
-                         )
+            result.count("1 received"),
+            1,
+            "Ping to outside world from VM should be successful"
+        )
 
         self.debug("Checking if we can SSH into VM using LB rule?")
         try:
             ssh_3 = vm_3.get_ssh_client(
-                            ipaddress=public_ip_3.ipaddress.ipaddress,
-                            reconnect=True,
-                            port=self.services["lbrule"]["publicport"]
-                            )
+                ipaddress=public_ip_3.ipaddress.ipaddress,
+                reconnect=True,
+                port=self.services["lbrule"]["publicport"]
+            )
             self.debug("SSH into VM is successfully")
 
             self.debug("Verifying if we can ping to outside world from VM?")
             res = ssh_3.execute("ping -c 1 www.google.com")
         except Exception as e:
             self.fail("Failed to SSH into VM - %s, %s" %
-                                        (public_ip_3.ipaddress.ipaddress, e))
+                      (public_ip_3.ipaddress.ipaddress, e))
 
         result = str(res)
         self.debug("Result: %s" % result)
         self.assertEqual(
-                         result.count("1 received"),
-                         1,
-                         "Ping to outside world from VM should be successful"
-                         )
+            result.count("1 received"),
+            1,
+            "Ping to outside world from VM should be successful"
+        )
         return
 
     @attr(tags=["advanced", "intervlan"], required_hardware="true")
@@ -1182,9 +1202,9 @@ class TestVPC(cloudstackTestCase):
         self.cleanup = []
         self.debug("Creating a VPC offering..")
         vpc_off = VpcOffering.create(
-                                     self.apiclient,
-                                     self.services["vpc_offering"]
-                                     )
+            self.apiclient,
+            self.services["vpc_offering"]
+        )
 
         self.cleanup.append(vpc_off)
         self.validate_vpc_offering(vpc_off)
@@ -1193,248 +1213,250 @@ class TestVPC(cloudstackTestCase):
         vpc_off.update(self.apiclient, state='Enabled')
 
         self.debug("creating a VPC network in the account: %s" %
-                                                    self.account.name)
+                   self.account.name)
         self.services["vpc"]["cidr"] = '10.1.1.1/16'
         vpc = VPC.create(
-                         self.apiclient,
-                         self.services["vpc"],
-                         vpcofferingid=vpc_off.id,
-                         zoneid=self.zone.id,
-                         account=self.account.name,
-                         domainid=self.account.domainid
-                         )
+            self.apiclient,
+            self.services["vpc"],
+            vpcofferingid=vpc_off.id,
+            zoneid=self.zone.id,
+            account=self.account.name,
+            domainid=self.account.domainid
+        )
         self.validate_vpc_network(vpc)
 
         self.network_offering = NetworkOffering.create(
-                                            self.apiclient,
-                                            self.services["network_offering"],
-                                            conservemode=False
-                                            )
+            self.apiclient,
+            self.services["network_offering"],
+            conservemode=False
+        )
         # Enable Network offering
         self.network_offering.update(self.apiclient, state='Enabled')
         self.cleanup.append(self.network_offering)
 
         self.network_offering_no_lb = NetworkOffering.create(
-                                    self.apiclient,
-                                    self.services["network_offering_no_lb"],
-                                    conservemode=False
-                                    )
+            self.apiclient,
+            self.services["network_offering_no_lb"],
+            conservemode=False
+        )
         # Enable Network offering
         self.network_offering_no_lb.update(self.apiclient, state='Enabled')
         self.cleanup.append(self.network_offering_no_lb)
 
         # Creating network using the network offering created
         self.debug("Creating network with network offering: %s" %
-                                                    self.network_offering.id)
+                   self.network_offering.id)
         network_1 = Network.create(
-                                self.apiclient,
-                                self.services["network"],
-                                accountid=self.account.name,
-                                domainid=self.account.domainid,
-                                networkofferingid=self.network_offering_no_lb.id,
-                                zoneid=self.zone.id,
-                                gateway='10.1.1.1',
-                                vpcid=vpc.id
-                                )
+            self.apiclient,
+            self.services["network"],
+            accountid=self.account.name,
+            domainid=self.account.domainid,
+            networkofferingid=self.network_offering_no_lb.id,
+            zoneid=self.zone.id,
+            gateway='10.1.1.1',
+            vpcid=vpc.id
+        )
         self.debug("Created network with ID: %s" % network_1.id)
 
         # Creating network using the network offering created
         self.debug("Creating network with network offering: %s" %
-                                            self.network_offering_no_lb.id)
+                   self.network_offering_no_lb.id)
         network_2 = Network.create(
-                            self.apiclient,
-                            self.services["network"],
-                            accountid=self.account.name,
-                            domainid=self.account.domainid,
-                            networkofferingid=self.network_offering.id,
-                            zoneid=self.zone.id,
-                            gateway='10.1.2.1',
-                            vpcid=vpc.id
-                            )
+            self.apiclient,
+            self.services["network"],
+            accountid=self.account.name,
+            domainid=self.account.domainid,
+            networkofferingid=self.network_offering.id,
+            zoneid=self.zone.id,
+            gateway='10.1.2.1',
+            vpcid=vpc.id
+        )
         self.debug("Created network with ID: %s" % network_2.id)
 
         self.debug("deploying VMs in network: %s" % network_1.name)
         # Spawn an instance in that network
         vm_1 = VirtualMachine.create(
-                                  self.apiclient,
-                                  self.services["virtual_machine"],
-                                  accountid=self.account.name,
-                                  domainid=self.account.domainid,
-                                  serviceofferingid=self.service_offering.id,
-                                  networkids=[str(network_1.id)]
-                                  )
+            self.apiclient,
+            self.services["virtual_machine"],
+            accountid=self.account.name,
+            domainid=self.account.domainid,
+            serviceofferingid=self.service_offering.id,
+            networkids=[str(network_1.id)]
+        )
         self.debug("Deployed VM in network: %s" % network_1.id)
 
         vm_2 = VirtualMachine.create(
-                                  self.apiclient,
-                                  self.services["virtual_machine"],
-                                  accountid=self.account.name,
-                                  domainid=self.account.domainid,
-                                  serviceofferingid=self.service_offering.id,
-                                  networkids=[str(network_1.id)]
-                                  )
+            self.apiclient,
+            self.services["virtual_machine"],
+            accountid=self.account.name,
+            domainid=self.account.domainid,
+            serviceofferingid=self.service_offering.id,
+            networkids=[str(network_1.id)]
+        )
         self.debug("Deployed VM in network: %s" % network_1.id)
 
         self.debug("deploying VMs in network: %s" % network_2.name)
         # Spawn an instance in that network
         vm_3 = VirtualMachine.create(
-                                  self.apiclient,
-                                  self.services["virtual_machine"],
-                                  accountid=self.account.name,
-                                  domainid=self.account.domainid,
-                                  serviceofferingid=self.service_offering.id,
-                                  networkids=[str(network_2.id)]
-                                  )
+            self.apiclient,
+            self.services["virtual_machine"],
+            accountid=self.account.name,
+            domainid=self.account.domainid,
+            serviceofferingid=self.service_offering.id,
+            networkids=[str(network_2.id)]
+        )
         self.debug("Deployed VM in network: %s" % network_2.id)
 
         vm_4 = VirtualMachine.create(
-                                  self.apiclient,
-                                  self.services["virtual_machine"],
-                                  accountid=self.account.name,
-                                  domainid=self.account.domainid,
-                                  serviceofferingid=self.service_offering.id,
-                                  networkids=[str(network_2.id)]
-                                  )
+            self.apiclient,
+            self.services["virtual_machine"],
+            accountid=self.account.name,
+            domainid=self.account.domainid,
+            serviceofferingid=self.service_offering.id,
+            networkids=[str(network_2.id)]
+        )
         self.debug("Deployed VM in network: %s" % network_2.id)
 
         self.debug("Associating public IP for network: %s" % network_1.name)
         public_ip_1 = PublicIPAddress.create(
-                                self.apiclient,
-                                accountid=self.account.name,
-                                zoneid=self.zone.id,
-                                domainid=self.account.domainid,
-                                networkid=network_1.id,
-                                vpcid=vpc.id
-                                )
+            self.apiclient,
+            accountid=self.account.name,
+            zoneid=self.zone.id,
+            domainid=self.account.domainid,
+            networkid=network_1.id,
+            vpcid=vpc.id
+        )
         self.debug("Associated %s with network %s" % (
-                                        public_ip_1.ipaddress.ipaddress,
-                                        network_1.id
-                                        ))
-
-        nat_rule = NATRule.create(
-                                  self.apiclient,
-                                  vm_1,
-                                  self.services["natrule"],
-                                  ipaddressid=public_ip_1.ipaddress.id,
-                                  openfirewall=False,
-                                  networkid=network_1.id,
-                                  vpcid=vpc.id
-                                  )
+            public_ip_1.ipaddress.ipaddress,
+            network_1.id
+        ))
+
+        NATRule.create(
+            self.apiclient,
+            vm_1,
+            self.services["natrule"],
+            ipaddressid=public_ip_1.ipaddress.id,
+            openfirewall=False,
+            networkid=network_1.id,
+            vpcid=vpc.id
+        )
 
         self.debug("Adding NetwrokACl rules to make NAT rule accessible")
-        nwacl_nat = NetworkACL.create(
-                                         self.apiclient,
-                                         networkid=network_1.id,
-                                         services=self.services["natrule"],
-                                         traffictype='Ingress'
-                                         )
+        NetworkACL.create(
+            self.apiclient,
+            networkid=network_1.id,
+            services=self.services["natrule"],
+            traffictype='Ingress'
+        )
 
         self.debug("Associating public IP for network: %s" % network_1.name)
         public_ip_2 = PublicIPAddress.create(
-                                self.apiclient,
-                                accountid=self.account.name,
-                                zoneid=self.zone.id,
-                                domainid=self.account.domainid,
-                                networkid=network_1.id,
-                                vpcid=vpc.id
-                                )
+            self.apiclient,
+            accountid=self.account.name,
+            zoneid=self.zone.id,
+            domainid=self.account.domainid,
+            networkid=network_1.id,
+            vpcid=vpc.id
+        )
         self.debug("Associated %s with network %s" % (
-                                        public_ip_2.ipaddress.ipaddress,
-                                        network_1.id
-                                        ))
+            public_ip_2.ipaddress.ipaddress,
+            network_1.id
+        ))
         self.debug("Enabling static NAT for IP: %s" %
-                                            public_ip_2.ipaddress.ipaddress)
+                   public_ip_2.ipaddress.ipaddress)
         try:
             StaticNATRule.enable(
-                              self.apiclient,
-                              ipaddressid=public_ip_2.ipaddress.id,
-                              virtualmachineid=vm_2.id,
-                              networkid=network_1.id
-                              )
+                self.apiclient,
+                ipaddressid=public_ip_2.ipaddress.id,
+                virtualmachineid=vm_2.id,
+                networkid=network_1.id
+            )
             self.debug("Static NAT enabled for IP: %s" %
-                                            public_ip_2.ipaddress.ipaddress)
+                       public_ip_2.ipaddress.ipaddress)
         except Exception as e:
             self.fail("Failed to enable static NAT on IP: %s - %s" % (
-                                        public_ip_2.ipaddress.ipaddress, e))
+                public_ip_2.ipaddress.ipaddress, e))
 
         public_ips = PublicIPAddress.list(
-                                    self.apiclient,
-                                    networkid=network_1.id,
-                                    listall=True,
-                                    isstaticnat=True,
-                                    account=self.account.name,
-                                    domainid=self.account.domainid
-                                  )
+            self.apiclient,
+            networkid=network_1.id,
+            listall=True,
+            isstaticnat=True,
+            account=self.account.name,
+            domainid=self.account.domainid
+        )
         self.assertEqual(
-                         isinstance(public_ips, list),
-                         True,
-                         "List public Ip for network should list the Ip addr"
-                         )
+            isinstance(public_ips, list),
+            True,
+            "List public Ip for network should list the Ip addr"
+        )
         self.assertEqual(
-                         public_ips[0].ipaddress,
-                         public_ip_2.ipaddress.ipaddress,
-                         "List public Ip for network should list the Ip addr"
-                         )
+            public_ips[0].ipaddress,
+            public_ip_2.ipaddress.ipaddress,
+            "List public Ip for network should list the Ip addr"
+        )
 
         self.debug("Associating public IP for network: %s" % vpc.name)
         public_ip_3 = PublicIPAddress.create(
-                                self.apiclient,
-                                accountid=self.account.name,
-                                zoneid=self.zone.id,
-                                domainid=self.account.domainid,
-                                networkid=network_2.id,
-                                vpcid=vpc.id
-                                )
+            self.apiclient,
+            accountid=self.account.name,
+            zoneid=self.zone.id,
+            domainid=self.account.domainid,
+            networkid=network_2.id,
+            vpcid=vpc.id
+        )
         self.debug("Associated %s with network %s" % (
-                                        public_ip_3.ipaddress.ipaddress,
-                                        network_2.id
-                                        ))
+            public_ip_3.ipaddress.ipaddress,
+            network_2.id
+        ))
 
         self.debug("Creating LB rule for IP address: %s" %
-                                        public_ip_3.ipaddress.ipaddress)
+                   public_ip_3.ipaddress.ipaddress)
 
         lb_rule = LoadBalancerRule.create(
-                                    self.apiclient,
-                                    self.services["lbrule"],
-                                    ipaddressid=public_ip_3.ipaddress.id,
-                                    accountid=self.account.name,
-                                    networkid=network_2.id,
-                                    vpcid=vpc.id,
-                                    domainid=self.account.domainid
-                                )
+            self.apiclient,
+            self.services["lbrule"],
+            ipaddressid=public_ip_3.ipaddress.id,
+            accountid=self.account.name,
+            networkid=network_2.id,
+            vpcid=vpc.id,
+            domainid=self.account.domainid
+        )
 
         self.debug("Adding virtual machines %s and %s to LB rule" % (
-                                    vm_3.name, vm_4.name))
+            vm_3.name, vm_4.name))
         lb_rule.assign(self.apiclient, [vm_3, vm_4])
 
         self.debug("Adding NetwrokACl rules to make PF and LB accessible")
-        nwacl_lb = NetworkACL.create(
-                                self.apiclient,
-                                networkid=network_2.id,
-                                services=self.services["lbrule"],
-                                traffictype='Ingress'
-                                )
-
-        self.debug("Adding Egress rules to network %s and %s to allow access to internet")
-        nwacl_internet_1 = NetworkACL.create(
-                                self.apiclient,
-                                networkid=network_1.id,
-                                services=self.services["icmp_rule"],
-                                traffictype='Egress'
-                                )
-        nwacl_internet_2 = NetworkACL.create(
-                                self.apiclient,
-                                networkid=network_2.id,
-                                services=self.services["icmp_rule"],
-                                traffictype='Egress'
-                                )
+        NetworkACL.create(
+            self.apiclient,
+            networkid=network_2.id,
+            services=self.services["lbrule"],
+            traffictype='Ingress'
+        )
+
+        self.debug(
+            "Adding Egress rules to network %s and %s to allow\
+            access to internet")
+        NetworkACL.create(
+            self.apiclient,
+            networkid=network_1.id,
+            services=self.services["icmp_rule"],
+ 

<TRUNCATED>