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/09/26 11:17:12 UTC

[1/4] CLOUDSTACK-7616: Fixed test_escalations_ipaddress.py - test suite should use its own vpc offering

Repository: cloudstack
Updated Branches:
  refs/heads/master 05913e3cb -> e5efa702b


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/0b9938ce/test/integration/component/test_escalations_ipaddresses.py
----------------------------------------------------------------------
diff --git a/test/integration/component/test_escalations_ipaddresses.py b/test/integration/component/test_escalations_ipaddresses.py
index 00aacbf..b29cd1d 100644
--- a/test/integration/component/test_escalations_ipaddresses.py
+++ b/test/integration/component/test_escalations_ipaddresses.py
@@ -43,6 +43,7 @@ from marvin.lib.utils import validateList, cleanup_resources
 from marvin.codes import PASS
 from nose.plugins.attrib import attr
 
+
 class TestIpAddresses(cloudstackTestCase):
 
     @classmethod
@@ -55,30 +56,41 @@ class TestIpAddresses(cloudstackTestCase):
             cls.hypervisor = cls.testClient.getHypervisorInfo()
             # Get Domain, Zone, Template
             cls.domain = get_domain(cls.api_client)
-            cls.zone = get_zone(cls.api_client, cls.testClient.getZoneForTests())
+            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"]
+            )
             if cls.zone.localstorageenabled:
                 cls.storagetype = 'local'
-                cls.services["service_offerings"]["tiny"]["storagetype"] = 'local'
+                cls.services["service_offerings"][
+                    "tiny"]["storagetype"] = 'local'
             else:
                 cls.storagetype = 'shared'
-                cls.services["service_offerings"]["tiny"]["storagetype"] = 'shared'
+                cls.services["service_offerings"][
+                    "tiny"]["storagetype"] = 'shared'
 
             cls.services['mode'] = cls.zone.networktype
-            cls.services["virtual_machine"]["hypervisor"] = cls.testClient.getHypervisorInfo()
+            cls.services["virtual_machine"][
+                "hypervisor"] = cls.testClient.getHypervisorInfo()
             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_offerings"]["tiny"]
-                                                          )
+                cls.api_client,
+                cls.services["service_offerings"]["tiny"]
+            )
             cls._cleanup.append(cls.service_offering)
             cls.services['mode'] = cls.zone.networktype
 
+            cls.vpc_offering = VpcOffering.create(cls.api_client,
+                                                  cls.services["vpc_offering"]
+                                                  )
+            cls.vpc_offering.update(cls.api_client, state='Enabled')
+            cls._cleanup.append(cls.vpc_offering)
+
         except Exception as e:
             cls.tearDownClass()
             raise Exception("Warning: Exception in setup : %s" % e)
@@ -89,14 +101,15 @@ class TestIpAddresses(cloudstackTestCase):
         self.apiClient = self.testClient.getApiClient()
         self.cleanup = []
         self.account = Account.create(
-                                self.apiClient,
-                                self.services["account"],
-                                domainid=self.domain.id
-                                )
+            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.cleanup.append(self.account)
+        self.userapiclient = self.testClient.getUserApiClient(
+            self.user.username,
+            self.domain.name)
 
     def tearDown(self):
         # Clean up, terminate the created volumes
@@ -111,13 +124,14 @@ class TestIpAddresses(cloudstackTestCase):
             raise Exception("Warning: Exception during cleanup : %s" % e)
 
     def __verify_values(self, expected_vals, actual_vals):
-        """  
+        """
         @summary: Function to verify expected and actual values
         Step1: Initializing return flag to True
-        Step1: Verifying length of expected and actual dictionaries is matching.
+        Step1: Verifying length of expected and actual dictionaries is matching
                If not matching returning false
         Step2: Listing all the keys from expected dictionary
-        Step3: Looping through each key from step2 and verifying expected and actual dictionaries have same value
+        Step3: Looping through each key from step2 and verifying expected
+               and actual dictionaries have same value
                If not making return flag to False
         Step4: returning the return flag after all the values are verified
         """
@@ -134,10 +148,10 @@ class TestIpAddresses(cloudstackTestCase):
                 return_flag = return_flag and True
             else:
                 return_flag = return_flag and False
-                self.debug("expected Value: %s, is not matching with actual value: %s" % (
-                                                                                          exp_val,
-                                                                                          act_val
-                                                                                          ))
+                self.debug(
+                    "expected Value: %s, is not matching with actual value: %s"
+                    %
+                    (exp_val, act_val))
         return return_flag
 
     @attr(tags=["advanced"], required_hardware="true")
@@ -152,7 +166,8 @@ class TestIpAddresses(cloudstackTestCase):
         Step5: Listing all the IP Addresses again
         Step6: Verifying the length of the IP Addresses is (page size + 1)
         Step7: Listing all the IP Addresses in page1
-        Step8: Verifying that the length of the IP Addresses in page 1 is (page size)
+        Step8: Verifying that the length of the IP Addresses in page 1 is
+               (page size)
         Step9: Listing all the IP Addresses in page2
         Step10: Verifying that the length of the IP Addresses in page 2 is 1
         Step11: Dis-Associating the IP Addresses present in page 2
@@ -161,154 +176,154 @@ class TestIpAddresses(cloudstackTestCase):
         """
         # Listing all the networks available
         networks_list_before = Network.list(
-                                            self.userapiclient,
-                                            forvpc="false",
-                                            domainid=self.domain.id,
-                                            account=self.account.name,
-                                            type="Isolated"
-                                            )
+            self.userapiclient,
+            forvpc="false",
+            domainid=self.domain.id,
+            account=self.account.name,
+            type="Isolated"
+        )
         self.assertIsNone(
-                          networks_list_before,
-                          "Networks listed for newly created user"
-                          )
+            networks_list_before,
+            "Networks listed for newly created user"
+        )
         # Listing Network Offerings
         network_offerings_list = NetworkOffering.list(
-                                                      self.apiClient,
-                                                      forvpc="false",
-                                                      guestiptype="Isolated",
-                                                      state="Enabled",
-                                                      supportedservices="SourceNat",
-                                                      zoneid=self.zone.id
-                                                      )
+            self.apiClient,
+            forvpc="false",
+            guestiptype="Isolated",
+            state="Enabled",
+            supportedservices="SourceNat",
+            zoneid=self.zone.id
+        )
         status = validateList(network_offerings_list)
         self.assertEquals(
-                          PASS,
-                          status[0],
-                          "Isolated Network Offerings with sourceNat enabled are not found"
-                          )
+            PASS,
+            status[0],
+            "Isolated Network Offerings with sourceNat enabled are not found"
+        )
         # Creating a network
         network = Network.create(
-                                  self.userapiclient,
-                                  self.services["network"],
-                                  accountid=self.account.name,
-                                  domainid=self.domain.id,
-                                  networkofferingid=network_offerings_list[0].id,
-                                  zoneid=self.zone.id
-                                  )
+            self.userapiclient,
+            self.services["network"],
+            accountid=self.account.name,
+            domainid=self.domain.id,
+            networkofferingid=network_offerings_list[0].id,
+            zoneid=self.zone.id
+        )
         self.assertIsNotNone(
-                             network,
-                             "Network creation failed"
-                             )
+            network,
+            "Network creation failed"
+        )
         self.cleanup.append(network)
         # Listing all the networks available
         networks_list_after = Network.list(
-                                           self.userapiclient,
-                                           forvpc="false",
-                                           domainid=self.domain.id,
-                                           account=self.account.name,
-                                           type="Isolated"
-                                           )
+            self.userapiclient,
+            forvpc="false",
+            domainid=self.domain.id,
+            account=self.account.name,
+            type="Isolated"
+        )
         status = validateList(networks_list_after)
         self.assertEquals(
-                          PASS,
-                          status[0],
-                          "Network Creation Failed"
-                          )
+            PASS,
+            status[0],
+            "Network Creation Failed"
+        )
         self.assertEquals(
-                          1,
-                          len(networks_list_after),
-                          "Network creation failed"
-                          )
+            1,
+            len(networks_list_after),
+            "Network creation failed"
+        )
         # Listing all the IP Addresses for a user
         list_ipaddresses_before = PublicIPAddress.list(
-                                                       self.userapiclient,
-                                                       listall=self.services["listall"]
-                                                       )
+            self.userapiclient,
+            listall=self.services["listall"]
+        )
         self.assertIsNone(
-                          list_ipaddresses_before,
-                          "IP Addresses listed for newly created user"
-                          )
+            list_ipaddresses_before,
+            "IP Addresses listed for newly created user"
+        )
         # Associating (pagesize + 1) number of IP Addresses
         for i in range(0, (self.services["pagesize"] + 1)):
             ipaddress = PublicIPAddress.create(
-                                               self.userapiclient,
-                                               services=self.services["network"],
-                                               networkid=network.id
-                                               )
+                self.userapiclient,
+                services=self.services["network"],
+                networkid=network.id
+            )
             self.assertIsNotNone(
-                                 ipaddress,
-                                 "Failed to Associate IP Address"
-                                 )
+                ipaddress,
+                "Failed to Associate IP Address"
+            )
 
         # Listing all the IP Addresses for a user
         list_ipaddresses_after = PublicIPAddress.list(
-                                                      self.userapiclient,
-                                                      listall=self.services["listall"]
-                                                      )
+            self.userapiclient,
+            listall=self.services["listall"]
+        )
         status = validateList(list_ipaddresses_after)
         self.assertEquals(
-                          PASS,
-                          status[0],
-                          "IP Addresses Association Failed"
-                          )
+            PASS,
+            status[0],
+            "IP Addresses Association Failed"
+        )
         # Verifying the length of the volumes is (page size + 1)
         self.assertEqual(
-                         (self.services["pagesize"] + 1),
-                         len(list_ipaddresses_after),
-                         "Number of IP Addresses associated are not matching expected"
-                         )
+            (self.services["pagesize"] + 1),
+            len(list_ipaddresses_after),
+            "Number of IP Addresses associated are not matching expected"
+        )
         # Listing IP Address in page 1
         list_ipaddress_page1 = PublicIPAddress.list(
-                                                    self.userapiclient,
-                                                    listall=self.services["listall"],
-                                                    page=1,
-                                                    pagesize=self.services["pagesize"]
-                                                    )
+            self.userapiclient,
+            listall=self.services["listall"],
+            page=1,
+            pagesize=self.services["pagesize"]
+        )
         status = validateList(list_ipaddress_page1)
         self.assertEquals(
-                          PASS,
-                          status[0],
-                          "Failed to list IP Addresses in page1"
-                          )
+            PASS,
+            status[0],
+            "Failed to list IP Addresses in page1"
+        )
         # Verifying that list size is equals to pagesize
         self.assertEquals(
-                          self.services["pagesize"],
-                          len(list_ipaddress_page1),
-                          "Failed to list pagesize number of IP Addresses in page1"
-                          )
+            self.services["pagesize"],
+            len(list_ipaddress_page1),
+            "Failed to list pagesize number of IP Addresses in page1"
+        )
         # Listing IP Address in page 2
         list_ipaddress_page2 = PublicIPAddress.list(
-                                                    self.userapiclient,
-                                                    listall=self.services["listall"],
-                                                    page=2,
-                                                    pagesize=self.services["pagesize"]
-                                                    )
+            self.userapiclient,
+            listall=self.services["listall"],
+            page=2,
+            pagesize=self.services["pagesize"]
+        )
         status = validateList(list_ipaddress_page2)
         self.assertEquals(
-                          PASS,
-                          status[0],
-                          "Failed to list IP Addresses in page2"
-                          )
+            PASS,
+            status[0],
+            "Failed to list IP Addresses in page2"
+        )
         # Verifying that List size is equal to 1
         self.assertEquals(
-                          1,
-                          len(list_ipaddress_page2),
-                          "Failed to list IP Addresses in page2"
-                          )
+            1,
+            len(list_ipaddress_page2),
+            "Failed to list IP Addresses in page2"
+        )
         # Dis-associating an IP Address
         ipaddress.delete(self.userapiclient)
         # Listing IP Address in page 2
         list_ipaddress_page2 = PublicIPAddress.list(
-                                                    self.userapiclient,
-                                                    listall=self.services["listall"],
-                                                    page=2,
-                                                    pagesize=self.services["pagesize"]
-                                                    )
+            self.userapiclient,
+            listall=self.services["listall"],
+            page=2,
+            pagesize=self.services["pagesize"]
+        )
         # Verifying that no IP Addresses are listed
         self.assertIsNone(
-                          list_ipaddress_page2,
-                          "Disassociation of IP Address Failed"
-                          )
+            list_ipaddress_page2,
+            "Disassociation of IP Address Failed"
+        )
         self.cleanup.append(self.account)
         return
 
@@ -329,163 +344,166 @@ class TestIpAddresses(cloudstackTestCase):
         """
         # Listing all the networks available
         networks_list_before = Network.list(
-                                            self.userapiclient,
-                                            forvpc="false",
-                                            domainid=self.domain.id,
-                                            account=self.account.name,
-                                            type="Isolated"
-                                            )
+            self.userapiclient,
+            forvpc="false",
+            domainid=self.domain.id,
+            account=self.account.name,
+            type="Isolated"
+        )
         self.assertIsNone(
-                          networks_list_before,
-                          "Networks listed for newly created user"
-                          )
+            networks_list_before,
+            "Networks listed for newly created user"
+        )
         # Listing Network Offerings
         network_offerings_list = NetworkOffering.list(
-                                                      self.apiClient,
-                                                      forvpc="false",
-                                                      guestiptype="Isolated",
-                                                      state="Enabled",
-                                                      supportedservices="SourceNat",
-                                                      zoneid=self.zone.id
-                                                      )
+            self.apiClient,
+            forvpc="false",
+            guestiptype="Isolated",
+            state="Enabled",
+            supportedservices="SourceNat",
+            zoneid=self.zone.id
+        )
         status = validateList(network_offerings_list)
         self.assertEquals(
-                          PASS,
-                          status[0],
-                          "Isolated Network Offerings with sourceNat enabled are not found"
-                          )
+            PASS,
+            status[0],
+            "Isolated Network Offerings with sourceNat enabled are not found"
+        )
         # Creating a network
         network = Network.create(
-                                  self.userapiclient,
-                                  self.services["network"],
-                                  accountid=self.account.name,
-                                  domainid=self.domain.id,
-                                  networkofferingid=network_offerings_list[0].id,
-                                  zoneid=self.zone.id
-                                  )
+            self.userapiclient,
+            self.services["network"],
+            accountid=self.account.name,
+            domainid=self.domain.id,
+            networkofferingid=network_offerings_list[0].id,
+            zoneid=self.zone.id
+        )
         self.assertIsNotNone(
-                             network,
-                             "Network creation failed"
-                             )
+            network,
+            "Network creation failed"
+        )
         self.cleanup.append(network)
         # Listing all the networks available
         networks_list_after = Network.list(
-                                           self.userapiclient,
-                                           forvpc="false",
-                                           domainid=self.domain.id,
-                                           account=self.account.name,
-                                           type="Isolated"
-                                           )
+            self.userapiclient,
+            forvpc="false",
+            domainid=self.domain.id,
+            account=self.account.name,
+            type="Isolated"
+        )
         status = validateList(networks_list_after)
         self.assertEquals(
-                          PASS,
-                          status[0],
-                          "Network Creation Failed"
-                          )
+            PASS,
+            status[0],
+            "Network Creation Failed"
+        )
         self.assertEquals(
-                          1,
-                          len(networks_list_after),
-                          "Network creation failed"
-                          )
+            1,
+            len(networks_list_after),
+            "Network creation failed"
+        )
         # Listing the Network By ID
         network_list_byid = Network.list(
-                                         self.userapiclient,
-                                         listall=self.services["listall"],
-                                         id=network.id
-                                         )
+            self.userapiclient,
+            listall=self.services["listall"],
+            id=network.id
+        )
         status = validateList(network_list_byid)
         self.assertEquals(
-                          PASS,
-                          status[0],
-                          "Failed to list Network by Id"
-                          )
+            PASS,
+            status[0],
+            "Failed to list Network by Id"
+        )
         self.assertEquals(
-                          1,
-                          len(network_list_byid),
-                          "Failed to list Network by Id"
-                          )
+            1,
+            len(network_list_byid),
+            "Failed to list Network by Id"
+        )
         # Listing all the IP Addresses for a user
         list_ipaddresses_before = PublicIPAddress.list(
-                                                       self.userapiclient,
-                                                       listall=self.services["listall"]
-                                                       )
+            self.userapiclient,
+            listall=self.services["listall"]
+        )
         self.assertIsNone(
-                          list_ipaddresses_before,
-                          "IP Addresses listed for newly created user"
-                          )
+            list_ipaddresses_before,
+            "IP Addresses listed for newly created user"
+        )
         # Associating an IP Addresses to Network created
         associated_ipaddress = PublicIPAddress.create(
-                                                      self.userapiclient,
-                                                      services=self.services["network"],
-                                                      networkid=network_list_byid[0].id
-                                                      )
+            self.userapiclient,
+            services=self.services["network"],
+            networkid=network_list_byid[0].id
+        )
         self.assertIsNotNone(
-                             associated_ipaddress,
-                             "Failed to Associate IP Address"
-                             )
+            associated_ipaddress,
+            "Failed to Associate IP Address"
+        )
         # Listing all the IP Addresses for a user
         list_ipaddresses_after = PublicIPAddress.list(
-                                                      self.userapiclient,
-                                                      listall=self.services["listall"]
-                                                      )
+            self.userapiclient,
+            listall=self.services["listall"]
+        )
         status = validateList(list_ipaddresses_after)
         self.assertEquals(
-                          PASS,
-                          status[0],
-                          "IP Addresses Association Failed"
-                          )
+            PASS,
+            status[0],
+            "IP Addresses Association Failed"
+        )
         # Verifying the length of the list is 1
         self.assertEqual(
-                         1,
-                         len(list_ipaddresses_after),
-                         "Number of IP Addresses associated are not matching expected"
-                         )
+            1,
+            len(list_ipaddresses_after),
+            "Number of IP Addresses associated are not matching expected"
+        )
         # Listing IP Address by id
         list_ipaddress_byid = PublicIPAddress.list(
-                                                   self.userapiclient,
-                                                   id=associated_ipaddress.ipaddress.id
-                                                    )
+            self.userapiclient,
+            id=associated_ipaddress.ipaddress.id
+        )
         status = validateList(list_ipaddress_byid)
         self.assertEquals(
-                          PASS,
-                          status[0],
-                          "Failed to list IP Addresses by ID"
-                          )
+            PASS,
+            status[0],
+            "Failed to list IP Addresses by ID"
+        )
         # Verifying that list size is equals to 1
         self.assertEquals(
-                          1,
-                          len(list_ipaddress_byid),
-                          "Failed to list IP Addresses by ID"
-                          )
-        # Verifying details of the listed IP Address to be same as IP Address created above
+            1,
+            len(list_ipaddress_byid),
+            "Failed to list IP Addresses by ID"
+        )
+        # Verifying details of the listed IP Address to be same as
+        # IP Address created above
         # Creating expected and actual values dictionaries
         expected_dict = {
-                         "id":associated_ipaddress.ipaddress.id,
-                         "associatednetworkid":associated_ipaddress.ipaddress.associatednetworkid,
-                         "associatednetworkname":associated_ipaddress.ipaddress.associatednetworkname,
-                         "ipaddress":associated_ipaddress.ipaddress.ipaddress,
-                         "issourcenat":associated_ipaddress.ipaddress.issourcenat,
-                         "isstaticnat":associated_ipaddress.ipaddress.isstaticnat,
-                         "networkid":associated_ipaddress.ipaddress.networkid
-                         }
+            "id": associated_ipaddress.ipaddress.id,
+            "associatednetworkid":
+            associated_ipaddress.ipaddress.associatednetworkid,
+            "associatednetworkname":
+            associated_ipaddress.ipaddress.associatednetworkname,
+            "ipaddress": associated_ipaddress.ipaddress.ipaddress,
+            "issourcenat": associated_ipaddress.ipaddress.issourcenat,
+            "isstaticnat": associated_ipaddress.ipaddress.isstaticnat,
+            "networkid": associated_ipaddress.ipaddress.networkid}
         actual_dict = {
-                       "id":list_ipaddress_byid[0].id,
-                       "associatednetworkid":list_ipaddress_byid[0].associatednetworkid,
-                       "associatednetworkname":list_ipaddress_byid[0].associatednetworkname,
-                       "ipaddress":list_ipaddress_byid[0].ipaddress,
-                       "issourcenat":list_ipaddress_byid[0].issourcenat,
-                       "isstaticnat":list_ipaddress_byid[0].isstaticnat,
-                       "networkid":list_ipaddress_byid[0].networkid
-                       }
+            "id": list_ipaddress_byid[0].id,
+            "associatednetworkid":
+            list_ipaddress_byid[0].associatednetworkid,
+            "associatednetworkname":
+            list_ipaddress_byid[0].associatednetworkname,
+            "ipaddress": list_ipaddress_byid[0].ipaddress,
+            "issourcenat": list_ipaddress_byid[0].issourcenat,
+            "isstaticnat": list_ipaddress_byid[0].isstaticnat,
+            "networkid": list_ipaddress_byid[0].networkid}
         ipaddress_status = self.__verify_values(
-                                                expected_dict,
-                                                actual_dict
-                                                )
+            expected_dict,
+            actual_dict
+        )
         self.assertEqual(
-                         True,
-                         ipaddress_status,
-                         "Listed IP Address details are not as expected"
-                         )
+            True,
+            ipaddress_status,
+            "Listed IP Address details are not as expected"
+        )
         self.cleanup.append(self.account)
         return
 
@@ -508,713 +526,720 @@ class TestIpAddresses(cloudstackTestCase):
         list_vpc_before = VPC.list(self.userapiclient)
         # Verifying No VPCs are listed
         self.assertIsNone(
-                          list_vpc_before,
-                          "VPC's Listed for newly Created User"
-                          )
-        # Listing VPC Offerings
-        list_vpc_offering = VpcOffering.list(self.userapiclient)
-        status = validateList(list_vpc_offering)
-        self.assertEquals(
-                          PASS,
-                          status[0],
-                          "list vpc offering is none")
+            list_vpc_before,
+            "VPC's Listed for newly Created User"
+        )
         # Creating a vpc
         vpc_created = VPC.create(
-                                 self.userapiclient,
-                                 self.services["vpc"],
-                                 list_vpc_offering[0].id,
-                                 self.zone.id
-                                )
+            self.userapiclient,
+            self.services["vpc"],
+            self.vpc_offering.id,
+            self.zone.id
+        )
         self.assertIsNotNone(
-                             vpc_created,
-                             "VPC Creation Failed"
-                             )
+            vpc_created,
+            "VPC Creation Failed"
+        )
         self.cleanup.append(vpc_created)
         # Listing the vpc for a user after creating a vpc
         list_vpc_after = VPC.list(self.userapiclient)
         status = validateList(list_vpc_after)
         self.assertEquals(
-                          PASS,
-                          status[0],
-                          "list VPC not as expected"
-                          )
+            PASS,
+            status[0],
+            "list VPC not as expected"
+        )
         # Verifying the list vpc size is increased by 1
         self.assertEquals(
-                          1,
-                          len(list_vpc_after),
-                          "list VPC not equal as expected"
-                          )
+            1,
+            len(list_vpc_after),
+            "list VPC not equal as expected"
+        )
         # Listing all the IP Addresses for a user
         list_ipaddresses_before = PublicIPAddress.list(
-                                                       self.userapiclient,
-                                                       listall=self.services["listall"]
-                                                       )
+            self.userapiclient,
+            listall=self.services["listall"]
+        )
         status = validateList(list_ipaddresses_before)
         self.assertEquals(
-                          PASS,
-                          status[0],
-                          "Failed to List VPC IP Address"
-                          )
+            PASS,
+            status[0],
+            "Failed to List VPC IP Address"
+        )
         self.assertEquals(
-                          1,
-                          len(list_ipaddresses_before),
-                          "Failed to List VPC IP Address"
-                          )
+            1,
+            len(list_ipaddresses_before),
+            "Failed to List VPC IP Address"
+        )
         # Associating an IP Addresses to VPC created
         associated_ipaddress = PublicIPAddress.create(
-                                                      self.userapiclient,
-                                                      services=self.services["network"],
-                                                      vpcid=vpc_created.id
-                                                      )
+            self.userapiclient,
+            services=self.services["network"],
+            vpcid=vpc_created.id
+        )
         self.assertIsNotNone(
-                             associated_ipaddress,
-                             "Failed to Associate IP Address"
-                             )
+            associated_ipaddress,
+            "Failed to Associate IP Address"
+        )
         # Listing all the IP Addresses for a user
         list_ipaddresses_after = PublicIPAddress.list(
-                                                      self.userapiclient,
-                                                      listall=self.services["listall"]
-                                                      )
+            self.userapiclient,
+            listall=self.services["listall"]
+        )
         status = validateList(list_ipaddresses_after)
         self.assertEquals(
-                          PASS,
-                          status[0],
-                          "IP Addresses Association Failed"
-                          )
+            PASS,
+            status[0],
+            "IP Addresses Association Failed"
+        )
         # Verifying the length of the list is 1
         self.assertEqual(
-                         len(list_ipaddresses_before) + 1,
-                         len(list_ipaddresses_after),
-                         "Number of IP Addresses associated are not matching expected"
-                         )
+            len(list_ipaddresses_before) + 1,
+            len(list_ipaddresses_after),
+            "Number of IP Addresses associated are not matching expected"
+        )
         # Listing IP Address by id
         list_ipaddress_byid = PublicIPAddress.list(
-                                                   self.userapiclient,
-                                                   listall=self.services["listall"],
-                                                   page=1,
-                                                   pagesize=self.services["pagesize"],
-                                                   id=associated_ipaddress.ipaddress.id
-                                                   )
+            self.userapiclient,
+            listall=self.services["listall"],
+            page=1,
+            pagesize=self.services["pagesize"],
+            id=associated_ipaddress.ipaddress.id
+        )
         status = validateList(list_ipaddress_byid)
         self.assertEquals(
-                          PASS,
-                          status[0],
-                          "Failed to list IP Addresses by ID"
-                          )
+            PASS,
+            status[0],
+            "Failed to list IP Addresses by ID"
+        )
         # Verifying that list size is equals to 1
         self.assertEquals(
-                          1,
-                          len(list_ipaddress_byid),
-                          "Failed to list IP Addresses by ID"
-                          )
-        # Verifying details of the listed IP Address to be same as IP Address created above
+            1,
+            len(list_ipaddress_byid),
+            "Failed to list IP Addresses by ID"
+        )
+        # Verifying details of the listed IP Address to be same as
+        # IP Address created above
         # Creating expected and actual values dictionaries
         expected_dict = {
-                         "id":associated_ipaddress.ipaddress.id,
-                         "associatednetworkid":associated_ipaddress.ipaddress.associatednetworkid,
-                         "associatednetworkname":associated_ipaddress.ipaddress.associatednetworkname,
-                         "ipaddress":associated_ipaddress.ipaddress.ipaddress,
-                         "issourcenat":associated_ipaddress.ipaddress.issourcenat,
-                         "isstaticnat":associated_ipaddress.ipaddress.isstaticnat,
-                         "networkid":associated_ipaddress.ipaddress.networkid,
-                         "vpcid":associated_ipaddress.ipaddress.vpcid
-                         }
+            "id": associated_ipaddress.ipaddress.id,
+            "associatednetworkid":
+            associated_ipaddress.ipaddress.associatednetworkid,
+            "associatednetworkname":
+            associated_ipaddress.ipaddress.associatednetworkname,
+            "ipaddress": associated_ipaddress.ipaddress.ipaddress,
+            "issourcenat": associated_ipaddress.ipaddress.issourcenat,
+            "isstaticnat": associated_ipaddress.ipaddress.isstaticnat,
+            "networkid": associated_ipaddress.ipaddress.networkid,
+            "vpcid": associated_ipaddress.ipaddress.vpcid}
         actual_dict = {
-                       "id":list_ipaddress_byid[0].id,
-                       "associatednetworkid":list_ipaddress_byid[0].associatednetworkid,
-                       "associatednetworkname":list_ipaddress_byid[0].associatednetworkname,
-                       "ipaddress":list_ipaddress_byid[0].ipaddress,
-                       "issourcenat":list_ipaddress_byid[0].issourcenat,
-                       "isstaticnat":list_ipaddress_byid[0].isstaticnat,
-                       "networkid":list_ipaddress_byid[0].networkid,
-                       "vpcid":list_ipaddress_byid[0].vpcid
-                       }
+            "id": list_ipaddress_byid[0].id,
+            "associatednetworkid":
+            list_ipaddress_byid[0].associatednetworkid,
+            "associatednetworkname":
+            list_ipaddress_byid[0].associatednetworkname,
+            "ipaddress": list_ipaddress_byid[0].ipaddress,
+            "issourcenat": list_ipaddress_byid[0].issourcenat,
+            "isstaticnat": list_ipaddress_byid[0].isstaticnat,
+            "networkid": list_ipaddress_byid[0].networkid,
+            "vpcid": list_ipaddress_byid[0].vpcid}
         ipaddress_status = self.__verify_values(
-                                                expected_dict,
-                                                actual_dict
-                                                )
+            expected_dict,
+            actual_dict
+        )
         self.assertEqual(
-                         True,
-                         ipaddress_status,
-                         "Listed IP Address details are not as expected"
-                         )
+            True,
+            ipaddress_status,
+            "Listed IP Address details are not as expected"
+        )
         self.cleanup.append(self.account)
         return
 
     @attr(tags=["advanced"], required_hardware="true")
     def test_04_create_delete_lbrule_fornonvpc(self):
         """
-        @summary: Test to list, create and delete Load Balancer Rule for IP Address associated to Non VPC network
+        @summary: Test to list, create and delete Load Balancer Rule
+        for IP Address associated to Non VPC network
         @Steps:
         Step1: Creating a Network for the user
         Step2: Associating an IP Addresses for Network
-        Step3: Listing Load Balancer Rules for the IP Address associated in Step2
+        Step3: Listing Load Balancer Rules for the IP Address associated in
+               Step2
         Step4: Verifying that no Load Balancer Rules are listed
-        Step5: Creating a Load Balancer Rule for IP Address associated in Step2
-        Step6: Listing Load Balancer Rules for the IP Address associated in Step2
+        Step5: Creating a Load Balancer Rule for IP Address associated in
+               Step2
+        Step6: Listing Load Balancer Rules for the IP Address associated in
+               Step2
         Step7: Verifying 1 Load Balancer Rule is listed
         Step8: Deleting the Load Balancer Rule created in Step5
-        Step9: Listing Load Balancer Rules for the IP Address associated in Step2
+        Step9: Listing Load Balancer Rules for the IP Address associated in
+               Step2
         Step10: Verifying that no Load Balancer Rules are listed
         """
         # Listing all the Networks's for a user
         list_networks_before = Network.list(
-                                            self.userapiclient,
-                                            listall=self.services["listall"],
-                                            type="Isolated"
-                                            )
+            self.userapiclient,
+            listall=self.services["listall"],
+            type="Isolated"
+        )
         # Verifying No Networks are listed
         self.assertIsNone(
-                          list_networks_before,
-                          "Networks listed for newly created User"
-                          )
+            list_networks_before,
+            "Networks listed for newly created User"
+        )
         # Listing Network Offerings
         network_offerings_list = NetworkOffering.list(
-                                                      self.apiClient,
-                                                      forvpc="false",
-                                                      guestiptype="Isolated",
-                                                      state="Enabled",
-                                                      supportedservices="SourceNat,Lb",
-                                                      zoneid=self.zone.id
-                                                      )
+            self.apiClient,
+            forvpc="false",
+            guestiptype="Isolated",
+            state="Enabled",
+            supportedservices="SourceNat,Lb",
+            zoneid=self.zone.id
+        )
         status = validateList(network_offerings_list)
         self.assertEquals(
-                          PASS,
-                          status[0],
-                          "Isolated Network Offerings with sourceNat, Lb enabled are not found"
-                          )
+            PASS,
+            status[0],
+            "Isolated Network Offerings with sourceNat, Lb enabled are\
+                    not found"
+        )
         # Creating a network
         network = Network.create(
-                                  self.userapiclient,
-                                  self.services["network"],
-                                  accountid=self.account.name,
-                                  domainid=self.domain.id,
-                                  networkofferingid=network_offerings_list[0].id,
-                                  zoneid=self.zone.id
-                                  )
+            self.userapiclient,
+            self.services["network"],
+            accountid=self.account.name,
+            domainid=self.domain.id,
+            networkofferingid=network_offerings_list[0].id,
+            zoneid=self.zone.id
+        )
         self.assertIsNotNone(
-                             network,
-                             "Network creation failed"
-                             )
+            network,
+            "Network creation failed"
+        )
         self.cleanup.append(network)
         # Listing all the IP Addresses for a user
         list_ipaddresses_before = PublicIPAddress.list(
-                                                       self.userapiclient,
-                                                       listall=self.services["listall"]
-                                                       )
+            self.userapiclient,
+            listall=self.services["listall"]
+        )
         # Verifying no IP Addresses are listed
         self.assertIsNone(
-                          list_ipaddresses_before,
-                          "IP Addresses listed for newly created User"
-                          )
+            list_ipaddresses_before,
+            "IP Addresses listed for newly created User"
+        )
         # Associating an IP Addresses to Network created
         associated_ipaddress = PublicIPAddress.create(
-                                                      self.userapiclient,
-                                                      services=self.services["network"],
-                                                      networkid=network.id
-                                                      )
+            self.userapiclient,
+            services=self.services["network"],
+            networkid=network.id
+        )
         self.assertIsNotNone(
-                             associated_ipaddress,
-                             "Failed to Associate IP Address"
-                             )
+            associated_ipaddress,
+            "Failed to Associate IP Address"
+        )
         # Listing all the IP Addresses for a user
         list_ipaddresses_after = PublicIPAddress.list(
-                                                      self.userapiclient,
-                                                      listall=self.services["listall"]
-                                                      )
+            self.userapiclient,
+            listall=self.services["listall"]
+        )
         status = validateList(list_ipaddresses_after)
         self.assertEquals(
-                          PASS,
-                          status[0],
-                          "IP Addresses Association Failed"
-                          )
+            PASS,
+            status[0],
+            "IP Addresses Association Failed"
+        )
         # Verifying the length of the list is 1
         self.assertEqual(
-                         1,
-                         len(list_ipaddresses_after),
-                         "Number of IP Addresses associated are not matching expected"
-                         )
+            1,
+            len(list_ipaddresses_after),
+            "Number of IP Addresses associated are not matching expected"
+        )
         # Listing Load Balancer Rules for the Ip Address
         list_lbrules_before = LoadBalancerRule.list(
-                                                    self.userapiclient,
-                                                    listall=self.services["listall"],
-                                                    publicipid=associated_ipaddress.ipaddress.id
-                                                    )
+            self.userapiclient,
+            listall=self.services["listall"],
+            publicipid=associated_ipaddress.ipaddress.id
+        )
         # Verifying no Load Balancer Rules are listed
         self.assertIsNone(
-                          list_lbrules_before,
-                          "Load Balancer Rules listed for newly Acquired Ip Address"
-                          )
+            list_lbrules_before,
+            "Load Balancer Rules listed for newly Acquired Ip Address"
+        )
         self.services["lbrule"]["openfirewall"] = 'false'
         # Creating a Load Balancer Rule for Ip Address
         lb_rule = LoadBalancerRule.create(
-                                          self.userapiclient,
-                                          self.services["lbrule"],
-                                          ipaddressid=associated_ipaddress.ipaddress.id,
-                                          )
+            self.userapiclient,
+            self.services["lbrule"],
+            ipaddressid=associated_ipaddress.ipaddress.id,
+        )
         self.assertIsNotNone(
-                             lb_rule,
-                             "Failed to create Load Balancer Rule"
-                             )
+            lb_rule,
+            "Failed to create Load Balancer Rule"
+        )
         # Verifying details of created Load Balancer Rule
         # Creating expected and actual values dictionaries
         expected_dict = {
-                         "algorithm":self.services["lbrule"]["alg"],
-                         "privateport":str(self.services["lbrule"]["privateport"]),
-                         "publicport":str(self.services["lbrule"]["publicport"]),
-                         "name":self.services["lbrule"]["name"],
-                         }
+            "algorithm": self.services["lbrule"]["alg"],
+            "privateport": str(self.services["lbrule"]["privateport"]),
+            "publicport": str(self.services["lbrule"]["publicport"]),
+            "name": self.services["lbrule"]["name"],
+        }
         actual_dict = {
-                       "algorithm":str(lb_rule.algorithm),
-                       "privateport":str(lb_rule.privateport),
-                       "publicport":str(lb_rule.publicport),
-                       "name":str(lb_rule.name),
-                       }
+            "algorithm": str(lb_rule.algorithm),
+            "privateport": str(lb_rule.privateport),
+            "publicport": str(lb_rule.publicport),
+            "name": str(lb_rule.name),
+        }
         lbrule_status = self.__verify_values(
-                                             expected_dict,
-                                             actual_dict
-                                             )
+            expected_dict,
+            actual_dict
+        )
         self.assertEqual(
-                         True,
-                         lbrule_status,
-                         "Created Load Balancer Rule details are not as expected"
-                         )
+            True,
+            lbrule_status,
+            "Created Load Balancer Rule details are not as expected"
+        )
         # Listing Load Balancer Rules for the Ip Address
         list_lbrules_after = LoadBalancerRule.list(
-                                                   self.userapiclient,
-                                                   listall=self.services["listall"],
-                                                   publicipid=associated_ipaddress.ipaddress.id
-                                                   )
+            self.userapiclient,
+            listall=self.services["listall"],
+            publicipid=associated_ipaddress.ipaddress.id
+        )
         status = validateList(list_lbrules_after)
         self.assertEquals(
-                          PASS,
-                          status[0],
-                          "Load Balancer Rule creation Failed"
-                          )
+            PASS,
+            status[0],
+            "Load Balancer Rule creation Failed"
+        )
         # Verifying the length of the list is 1
         self.assertEqual(
-                         1,
-                         len(list_lbrules_after),
-                         "Load Balancer Rule creation Failed"
-                         )
+            1,
+            len(list_lbrules_after),
+            "Load Balancer Rule creation Failed"
+        )
         # Deleting Load Balancer Rule
         lb_rule.delete(self.userapiclient)
         # Listing Load Balancer Rules for the Ip Address
         list_lbrules_after = LoadBalancerRule.list(
-                                                   self.userapiclient,
-                                                   listall=self.services["listall"],
-                                                   publicipid=associated_ipaddress.ipaddress.id
-                                                   )
+            self.userapiclient,
+            listall=self.services["listall"],
+            publicipid=associated_ipaddress.ipaddress.id
+        )
         # Verifying no Load Balancer Rules are Listed
         self.assertIsNone(
-                          list_lbrules_after,
-                          "Failed to delete Load Balancer Rule"
-                          )
+            list_lbrules_after,
+            "Failed to delete Load Balancer Rule"
+        )
         self.cleanup.append(self.account)
         return
 
     @attr(tags=["advanced"], required_hardware="true")
     def test_05_create_delete_lbrule_forvpc(self):
         """
-        @summary: Test to list, create and delete Load Balancer Rule for IP Address associated to VPC
+        @summary: Test to list, create and delete Load Balancer Rule for IP
+        Address associated to VPC
         @Steps:
         Step1: Creating a VPC for the user
         Step2: Creating Network inside VPC
         Step3: Associating an IP Addresses for VPC
-        Step4: Listing Load Balancer Rules for the IP Address associated in Step2
+        Step4: Listing Load Balancer Rules for the IP Address associated in
+               Step2
         Step5: Verifying that no Load Balancer Rules are listed
-        Step6: Creating a Load Balancer Rule for IP Address associated in Step2
-        Step7: Listing Load Balancer Rules for the IP Address associated in Step2
+        Step6: Creating a Load Balancer Rule for IP Address associated in
+               Step2
+        Step7: Listing Load Balancer Rules for the IP Address associated in
+               Step2
         Step8: Verifying 1 Load Balancer Rule is listed
         Step9: Deleting the Load Balancer Rule created in Step5
-        Step10: Listing Load Balancer Rules for the IP Address associated in Step2
+        Step10: Listing Load Balancer Rules for the IP Address associated in
+               Step2
         Step11: Verifying that no Load Balancer Rules are listed
         """
         # Listing all the vpc's for a user
         list_vpc_before = VPC.list(self.userapiclient)
         # Verifying No VPCs are listed
         self.assertIsNone(
-                          list_vpc_before,
-                          "VPC's Listed for newly Created User"
-                          )
-        # Listing VPC Offerings
-        list_vpc_offering = VpcOffering.list(self.userapiclient)
-        status = validateList(list_vpc_offering)
-        self.assertEquals(
-                          PASS,
-                          status[0],
-                          "list vpc offering is none")
+            list_vpc_before,
+            "VPC's Listed for newly Created User"
+        )
         # Creating a vpc
         vpc_created = VPC.create(
-                                 self.userapiclient,
-                                 self.services["vpc"],
-                                 list_vpc_offering[0].id,
-                                 self.zone.id
-                                )
+            self.userapiclient,
+            self.services["vpc"],
+            self.vpc_offering.id,
+            self.zone.id
+        )
         self.assertIsNotNone(
-                             vpc_created,
-                             "VPC Creation Failed"
-                             )
+            vpc_created,
+            "VPC Creation Failed"
+        )
         # Listing the vpc for a user after creating a vpc
         list_vpc_after = VPC.list(self.userapiclient)
         status = validateList(list_vpc_after)
         self.assertEquals(
-                          PASS,
-                          status[0],
-                          "list VPC not as expected"
-                          )
+            PASS,
+            status[0],
+            "list VPC not as expected"
+        )
         # Verifying the list vpc size is increased by 1
         self.assertEquals(
-                          1,
-                          len(list_vpc_after),
-                          "list VPC not equal as expected"
-                          )
+            1,
+            len(list_vpc_after),
+            "list VPC not equal as expected"
+        )
         # List network offering for vpc = true
         network_offering_vpc_true_list = NetworkOffering.list(
-                                                              self.userapiclient,
-                                                              forvpc="true",
-                                                              zoneid=self.zone.id,
-                                                              supportedServices="Lb",
-                                                              state="Enabled"
-                                                              )
+            self.userapiclient,
+            forvpc="true",
+            zoneid=self.zone.id,
+            supportedServices="Lb",
+            state="Enabled"
+        )
         status = validateList(network_offering_vpc_true_list)
-        self.assertEquals(PASS, status[0], "Default network offering not present for vpc = true with Lb")
+        self.assertEquals(
+            PASS,
+            status[0],
+            "Default network offering not present for vpc = true with Lb")
         # Creating network under VPC
         network_created = Network.create(
-                                         self.userapiclient,
-                                         self.services["ntwk"],
-                                         networkofferingid=network_offering_vpc_true_list[0].id,
-                                         vpcid=vpc_created.id,
-                                         zoneid=self.zone.id,
-                                         gateway=self.services["ntwk"]["gateway"],
-                                         netmask=self.services["ntwk"]["netmask"]
-                                     )
+            self.userapiclient,
+            self.services["ntwk"],
+            networkofferingid=network_offering_vpc_true_list[0].id,
+            vpcid=vpc_created.id,
+            zoneid=self.zone.id,
+            gateway=self.services["ntwk"]["gateway"],
+            netmask=self.services["ntwk"]["netmask"]
+        )
         self.cleanup.append(network_created)
         self.assertIsNotNone(
-                             network_created,
-                             "Network is not created"
-                             )
+            network_created,
+            "Network is not created"
+        )
         self.cleanup.append(vpc_created)
         # Listing all the IP Addresses for a user
         list_ipaddresses_before = PublicIPAddress.list(
-                                                       self.userapiclient,
-                                                       listall=self.services["listall"]
-                                                       )
+            self.userapiclient,
+            listall=self.services["listall"]
+        )
         status = validateList(list_ipaddresses_before)
         self.assertEquals(
-                          PASS,
-                          status[0],
-                          "list IP Addresses not as expected"
-                          )
+            PASS,
+            status[0],
+            "list IP Addresses not as expected"
+        )
         # Verifying the list vpc size is increased by 1
         self.assertEquals(
-                          1,
-                          len(list_ipaddresses_before),
-                          "list IP Addresses not equal as expected"
-                          )
+            1,
+            len(list_ipaddresses_before),
+            "list IP Addresses not equal as expected"
+        )
         # Associating an IP Addresses to VPC created
         associated_ipaddress = PublicIPAddress.create(
-                                                      self.userapiclient,
-                                                      services=self.services["network"],
-                                                      vpcid=vpc_created.id
-                                                      )
+            self.userapiclient,
+            services=self.services["network"],
+            vpcid=vpc_created.id
+        )
         self.assertIsNotNone(
-                             associated_ipaddress,
-                             "Failed to Associate IP Address"
-                             )
+            associated_ipaddress,
+            "Failed to Associate IP Address"
+        )
         # Listing all the IP Addresses for a user
         list_ipaddresses_after = PublicIPAddress.list(
-                                                      self.userapiclient,
-                                                      listall=self.services["listall"]
-                                                      )
+            self.userapiclient,
+            listall=self.services["listall"]
+        )
         status = validateList(list_ipaddresses_after)
         self.assertEquals(
-                          PASS,
-                          status[0],
-                          "IP Addresses Association Failed"
-                          )
+            PASS,
+            status[0],
+            "IP Addresses Association Failed"
+        )
         # Verifying the length of the list is 1
         self.assertEqual(
-                         len(list_ipaddresses_before) + 1,
-                         len(list_ipaddresses_after),
-                         "Number of IP Addresses associated are not matching expected"
-                         )
+            len(list_ipaddresses_before) + 1,
+            len(list_ipaddresses_after),
+            "Number of IP Addresses associated are not matching expected"
+        )
         # Listing Load Balancer Rules for the Ip Address
         list_lbrules_before = LoadBalancerRule.list(
-                                                    self.userapiclient,
-                                                    listall=self.services["listall"],
-                                                    publicipid=associated_ipaddress.ipaddress.id
-                                                    )
+            self.userapiclient,
+            listall=self.services["listall"],
+            publicipid=associated_ipaddress.ipaddress.id
+        )
         # Verifying no Load Balancer Rules are listed
         self.assertIsNone(
-                          list_lbrules_before,
-                          "Load Balancer Rules listed for newly Acquired Ip Address"
-                          )
+            list_lbrules_before,
+            "Load Balancer Rules listed for newly Acquired Ip Address"
+        )
         self.services["lbrule"]["openfirewall"] = 'false'
         # Creating a Load Balancer Rule for Ip Address
         lb_rule = LoadBalancerRule.create(
-                                          self.userapiclient,
-                                          self.services["lbrule"],
-                                          ipaddressid=associated_ipaddress.ipaddress.id,
-                                          networkid=network_created.id
-                                          )
+            self.userapiclient,
+            self.services["lbrule"],
+            ipaddressid=associated_ipaddress.ipaddress.id,
+            networkid=network_created.id
+        )
         self.assertIsNotNone(
-                             lb_rule,
-                             "Failed to create Load Balancer Rule"
-                             )
+            lb_rule,
+            "Failed to create Load Balancer Rule"
+        )
         # Verifying details of created Load Balancer Rule
         # Creating expected and actual values dictionaries
         expected_dict = {
-                         "algorithm":self.services["lbrule"]["alg"],
-                         "privateport":str(self.services["lbrule"]["privateport"]),
-                         "publicport":str(self.services["lbrule"]["publicport"]),
-                         "name":self.services["lbrule"]["name"],
-                         }
+            "algorithm": self.services["lbrule"]["alg"],
+            "privateport": str(self.services["lbrule"]["privateport"]),
+            "publicport": str(self.services["lbrule"]["publicport"]),
+            "name": self.services["lbrule"]["name"],
+        }
         actual_dict = {
-                       "algorithm":str(lb_rule.algorithm),
-                       "privateport":str(lb_rule.privateport),
-                       "publicport":str(lb_rule.publicport),
-                       "name":str(lb_rule.name),
-                       }
+            "algorithm": str(lb_rule.algorithm),
+            "privateport": str(lb_rule.privateport),
+            "publicport": str(lb_rule.publicport),
+            "name": str(lb_rule.name),
+        }
         lbrule_status = self.__verify_values(
-                                             expected_dict,
-                                             actual_dict
-                                             )
+            expected_dict,
+            actual_dict
+        )
         self.assertEqual(
-                         True,
-                         lbrule_status,
-                         "Created Load Balancer Rule details are not as expected"
-                         )
-       # Listing Load Balancer Rules for the Ip Address
+            True,
+            lbrule_status,
+            "Created Load Balancer Rule details are not as expected"
+        )
+        # Listing Load Balancer Rules for the Ip Address
         list_lbrules_after = LoadBalancerRule.list(
-                                                   self.userapiclient,
-                                                   listall=self.services["listall"],
-                                                   publicipid=associated_ipaddress.ipaddress.id,
-                                                   )
+            self.userapiclient,
+            listall=self.services["listall"],
+            publicipid=associated_ipaddress.ipaddress.id,
+        )
         status = validateList(list_lbrules_after)
         self.assertEquals(
-                          PASS,
-                          status[0],
-                          "Load Balancer Rule creation Failed"
-                          )
+            PASS,
+            status[0],
+            "Load Balancer Rule creation Failed"
+        )
         # Verifying the length of the list is 1
         self.assertEqual(
-                         1,
-                         len(list_lbrules_after),
-                         "Load Balancer Rule creation Failed"
-                         )
+            1,
+            len(list_lbrules_after),
+            "Load Balancer Rule creation Failed"
+        )
         # Deleting Load Balancer Rule
         lb_rule.delete(self.userapiclient)
         # Listing Load Balancer Rules for the Ip Address
         list_lbrules_after = LoadBalancerRule.list(
-                                                   self.userapiclient,
-                                                   listall=self.services["listall"],
-                                                   publicipid=associated_ipaddress.ipaddress.id
-                                                   )
+            self.userapiclient,
+            listall=self.services["listall"],
+            publicipid=associated_ipaddress.ipaddress.id
+        )
         # Verifying no Load Balancer Rules are Listed
         self.assertIsNone(
-                          list_lbrules_after,
-                          "Failed to delete Load Balancer Rule"
-                          )
+            list_lbrules_after,
+            "Failed to delete Load Balancer Rule"
+        )
         self.cleanup.append(self.account)
         return
 
     @attr(tags=["advanced"], required_hardware="true")
     def test_06_update_lbrule_name(self):
         """
-        @summary: Test to Update Load Balancer Rule Name for IP Address associated to Non VPC network
+        @summary: Test to Update Load Balancer Rule Name for
+                  IP Address associated to Non VPC network
         @Steps:
         Step1: Creating a Network for the user
         Step2: Associating an IP Addresses for Network
-        Step3: Listing Load Balancer Rules for the IP Address associated in Step2
+        Step3: Listing Load Balancer Rules for the IP Address associated
+               in Step2
         Step4: Verifying that no Load Balancer Rules are listed
         Step5: Creating a Load Balancer Rule for IP Address associated in Step2
-        Step6: Listing Load Balancer Rules for the IP Address associated in Step2
+        Step6: Listing Load Balancer Rules for the IP Address associated in
+               Step2
         Step7: Verifying 1 Load Balancer Rule is listed
         Step8: Updating the Load Balancer Rule created in Step5
         Step9: Verifying that Load Balancer Rule details are updated
         """
         # Listing all the Networks's for a user
         list_networks_before = Network.list(
-                                            self.userapiclient,
-                                            listall=self.services["listall"],
-                                            type="Isolated"
-                                            )
+            self.userapiclient,
+            listall=self.services["listall"],
+            type="Isolated"
+        )
         # Verifying No Networks are listed
         self.assertIsNone(
-                          list_networks_before,
-                          "Networks listed for newly created User"
-                          )
+            list_networks_before,
+            "Networks listed for newly created User"
+        )
         # Listing Network Offerings
         network_offerings_list = NetworkOffering.list(
-                                                      self.apiClient,
-                                                      forvpc="false",
-                                                      guestiptype="Isolated",
-                                                      state="Enabled",
-                                                      supportedservices="SourceNat,Lb",
-                                                      zoneid=self.zone.id
-                                                      )
+            self.apiClient,
+            forvpc="false",
+            guestiptype="Isolated",
+            state="Enabled",
+            supportedservices="SourceNat,Lb",
+            zoneid=self.zone.id
+        )
         status = validateList(network_offerings_list)
         self.assertEquals(
-                          PASS,
-                          status[0],
-                          "Isolated Network Offerings with sourceNat, Lb enabled are not found"
-                          )
+            PASS,
+            status[0],
+            "Isolated Network Offerings with sourceNat,\
+                    Lb enabled are not found"
+        )
         # Creating a network
         network = Network.create(
-                                  self.userapiclient,
-                                  self.services["network"],
-                                  accountid=self.account.name,
-                                  domainid=self.domain.id,
-                                  networkofferingid=network_offerings_list[0].id,
-                                  zoneid=self.zone.id
-                                  )
+            self.userapiclient,
+            self.services["network"],
+            accountid=self.account.name,
+            domainid=self.domain.id,
+            networkofferingid=network_offerings_list[0].id,
+            zoneid=self.zone.id
+        )
         self.assertIsNotNone(
-                             network,
-                             "Network creation failed"
-                             )
+            network,
+            "Network creation failed"
+        )
         self.cleanup.append(network)
         # Listing Networks again
         list_networks_after = Network.list(
-                                           self.userapiclient,
-                                           listall=self.services["listall"],
-                                           type="Isolated"
-                                           )
+            self.userapiclient,
+            listall=self.services["listall"],
+            type="Isolated"
+        )
         status = validateList(list_networks_after)
         self.assertEquals(
-                          PASS,
-                          status[0],
-                          "Network Creation Failed"
-                          )
+            PASS,
+            status[0],
+            "Network Creation Failed"
+        )
         # Verifying network list count is increased by 1
         self.assertEquals(
-                          1,
-                          len(list_networks_after),
-                          "Network Creation Failed"
-                          )
+            1,
+            len(list_networks_after),
+            "Network Creation Failed"
+        )
         # Listing all the IP Addresses for a user
         list_ipaddresses_before = PublicIPAddress.list(
-                                                       self.userapiclient,
-                                                       listall=self.services["listall"]
-                                                       )
+            self.userapiclient,
+            listall=self.services["listall"]
+        )
         # Verifying no IP Addresses are listed
         self.assertIsNone(
-                          list_ipaddresses_before,
-                          "IP Addresses listed for newly created User"
-                          )
+            list_ipaddresses_before,
+            "IP Addresses listed for newly created User"
+        )
         # Associating an IP Addresses to Network created
         associated_ipaddress = PublicIPAddress.create(
-                                                      self.userapiclient,
-                                                      services=self.services["network"],
-                                                      networkid=network.id
-                                                      )
+            self.userapiclient,
+            services=self.services["network"],
+            networkid=network.id
+        )
         self.assertIsNotNone(
-                             associated_ipaddress,
-                             "Failed to Associate IP Address"
-                             )
+            associated_ipaddress,
+            "Failed to Associate IP Address"
+        )
         # Listing all the IP Addresses for a user
         list_ipaddresses_after = PublicIPAddress.list(
-                                                      self.userapiclient,
-                                                      listall=self.services["listall"]
-                                                      )
+            self.userapiclient,
+            listall=self.services["listall"]
+        )
         status = validateList(list_ipaddresses_after)
         self.assertEquals(
-                          PASS,
-                          status[0],
-                          "IP Addresses Association Failed"
-                          )
+            PASS,
+            status[0],
+            "IP Addresses Association Failed"
+        )
         # Verifying the length of the list is 1
         self.assertEqual(
-                         1,
-                         len(list_ipaddresses_after),
-                         "Number of IP Addresses associated are not matching expected"
-                         )
+            1,
+            len(list_ipaddresses_after),
+            "Number of IP Addresses associated are not matching expected"
+        )
         # Listing Load Balancer Rules for the Ip Address
         list_lbrules_before = LoadBalancerRule.list(
-                                                    self.userapiclient,
-                                                    listall=self.services["listall"],
-                                                    publicipid=associated_ipaddress.ipaddress.id
-                                                    )
+            self.userapiclient,
+            listall=self.services["listall"],
+            publicipid=associated_ipaddress.ipaddress.id
+        )
         # Verifying no Load Balancer Rules are listed
         self.assertIsNone(
-                          list_lbrules_before,
-                          "Load Balancer Rules listed for newly Acquired Ip Address"
-                          )
+            list_lbrules_before,
+            "Load Balancer Rules listed for newly Acquired Ip Address"
+        )
         self.services["lbrule"]["openfirewall"] = 'false'
         # Creating a Load Balancer Rule for Ip Address
         lb_rule = LoadBalancerRule.create(
-                                          self.userapiclient,
-                                          self.services["lbrule"],
-                                          ipaddressid=associated_ipaddress.ipaddress.id,
-                                          )
+            self.userapiclient,
+            self.services["lbrule"],
+            ipaddressid=associated_ipaddress.ipaddress.id,
+        )
         self.assertIsNotNone(
-                             lb_rule,
-                             "Failed to create Load Balancer Rule"
-                             )
+            lb_rule,
+            "Failed to create Load Balancer Rule"
+        )
         # Listing Load Balancer Rules for the Ip Address
         list_lbrules_after = LoadBalancerRule.list(
-                                                   self.userapiclient,
-                                                   listall=self.services["listall"],
-                                                   publicipid=associated_ipaddress.ipaddress.id
-                                                   )
+            self.userapiclient,
+            listall=self.services["listall"],
+            publicipid=associated_ipaddress.ipaddress.id
+        )
         status = validateList(list_lbrules_after)
         self.assertEquals(
-                          PASS,
-                          status[0],
-                          "Load Balancer Rule creation Failed"
-                          )
+            PASS,
+            status[0],
+            "Load Balancer Rule creation Failed"
+        )
         # Verifying the length of the list is 1
         self.assertEqual(
-                         1,
-                         len(list_lbrules_after),
-                         "Load Balancer Rule creation Failed"
-                         )
+            1,
+            len(list_lbrules_after),
+            "Load Balancer Rule creation Failed"
+        )
         # Updating Load Balancer Rule Name
         updated_lb_rule = LoadBalancerRule.update(
-                                                  lb_rule,
-                                                  self.userapiclient,
-                                                  algorithm="source",
-                                                  name="NewLBRuleName"
-                                                  )
+            lb_rule,
+            self.userapiclient,
+            algorithm="source",
+            name="NewLBRuleName"
+        )
         self.assertIsNotNone(
-                             updated_lb_rule,
-                             "Failed to update Load Balancer Rule details"
-                             )
+            updated_lb_rule,
+            "Failed to update Load Balancer Rule details"
+        )
         # Verifying details of the updated Load Balancer Rule
         # Creating expected and actual values dictionaries
         expected_dict = {
-                         "id":lb_rule.id,
-                         "account":lb_rule.account,
-                         "algorithm":"source",
-                         "domainid":lb_rule.domainid,
-                         "name":"NewLBRuleName",
-                         "networkid":lb_rule.networkid,
-                         "zoneid":lb_rule.zoneid,
-                         "privateport":lb_rule.privateport,
-                         "publicip":lb_rule.publicip,
-                         "publicport":lb_rule.publicport,
-                         }
+            "id": lb_rule.id,
+            "account": lb_rule.account,
+            "algorithm": "source",
+                         "domainid": lb_rule.domainid,
+                         "name": "NewLBRuleName",
+                         "networkid": lb_rule.networkid,
+                         "zoneid": lb_rule.zoneid,
+                         "privateport": lb_rule.privateport,
+                         "publicip": lb_rule.publicip,
+                         "publicport": lb_rule.publicport,
+        }
         actual_dict = {
-                       "id":updated_lb_rule.id,
-                       "account":updated_lb_rule.account,
-                       "algorithm":updated_lb_rule.algorithm,
-                       "domainid":updated_lb_rule.domainid,
-                       "name":updated_lb_rule.name,
-                       "networkid":updated_lb_rule.networkid,
-                       "zoneid":updated_lb_rule.zoneid,
-                       "privateport":updated_lb_rule.privateport,
-                       "publicip":updated_lb_rule.publicip,
-                       "publicport":updated_lb_rule.publicport,
-                       }
+            "id": updated_lb_rule.id,
+            "account": updated_lb_rule.account,
+            "algorithm": updated_lb_rule.algorithm,
+            "domainid": updated_lb_rule.domainid,
+            "name": updated_lb_rule.name,
+            "networkid": updated_lb_rule.networkid,
+            "zoneid": updated_lb_rule.zoneid,
+            "privateport": updated_lb_rule.privateport,
+            "publicip": updated_lb_rule.publicip,
+            "publicport": updated_lb_rule.publicport,
+        }
         lbrule_status = self.__verify_values(
-                                             expected_dict,
-                                             actual_dict
-                                             )
+            expected_dict,
+            actual_dict
+        )
         self.assertEqual(
-                         True,
-                         lbrule_status,
-                         "Updated Load Balancer Rule details are not as expected"
-                         )
+            True,
+            lbrule_status,
+            "Updated Load Balancer Rule details are not as expected"
+        )
         self.cleanup.append(self.account)
         return
 
@@ -1244,291 +1269,301 @@ class TestIpAddresses(cloudstackTestCase):
         """
         # Listing all the Networks's for a user
         list_networks_before = Network.list(
-                                            self.userapiclient,
-                                            listall=self.services["listall"],
-                                            type="Isolated"
-                                            )
+            self.userapiclient,
+            listall=self.services["listall"],
+            type="Isolated"
+        )
         # Verifying No Networks are listed
         self.assertIsNone(
-                          list_networks_before,
-                          "Networks listed for newly created User"
-                          )
+            list_networks_before,
+            "Networks listed for newly created User"
+        )
         # Listing Network Offerings
         network_offerings_list = NetworkOffering.list(
-                                                      self.apiClient,
-                                                      forvpc="false",
-                                                      guestiptype="Isolated",
-                                                      state="Enabled",
-                                                      supportedservices="SourceNat,Lb",
-                                                      zoneid=self.zone.id
-                                                      )
+            self.apiClient,
+            forvpc="false",
+            guestiptype="Isolated",
+            state="Enabled",
+            supportedservices="SourceNat,Lb",
+            zoneid=self.zone.id
+        )
         status = validateList(network_offerings_list)
         self.assertEquals(
-                          PASS,
-                          status[0],
-                          "Isolated Network Offerings with sourceNat, Lb enabled are not found"
-                          )
+            PASS,
+            status[0],
+            "Isolated Network Offerings with sourceNat,\
+                    Lb enabled are not found"
+        )
         # Creating a network
         network = Network.create(
-                                  self.userapiclient,
-                                  self.services["network"],
-                                  accountid=self.account.name,
-                                  domainid=self.domain.id,
-                                  networkofferingid=network_offerings_list[0].id,
-                                  zoneid=self.zone.id
-                                  )
+            self.userapiclient,
+            self.services["network"],
+            accountid=self.account.name,
+            domainid=self.domain.id,
+            networkofferingid=network_offerings_list[0].id,
+            zoneid=self.zone.id
+        )
         self.assertIsNotNone(
-                             network,
-                             "Network creation failed"
-                             )
+            network,
+            "Network creation failed"
+        )
         # Listing all the IP Addresses for a user
         list_ipaddresses_before = PublicIPAddress.list(
-                                                       self.userapiclient,
-                                                       listall=self.services["listall"]
-                                                       )
+            self.userapiclient,
+            listall=self.services["listall"]
+        )
         # Verifying no IP Addresses are listed
         self.assertIsNone(
-                          list_ipaddresses_before,
-                          "IP Addresses listed for newly created User"
-                          )
+            list_ipaddresses_before,
+            "IP Addresses listed for newly created User"
+        )
         # Associating an IP Addresses to Network created
         associated_ipaddress = PublicIPAddress.create(
-                                                      self.userapiclient,
-                                                      services=self.services["network"],
-                                                      networkid=network.id
-                                                      )
+            self.userapiclient,
+            services=self.services["network"],
+            networkid=network.id
+        )
         self.assertIsNotNone(
-                             associated_ipaddress,
-                             "Failed to Associate IP Address"
-                             )
+            associated_ipaddress,
+            "Failed to Associate IP Address"
+        )
         # Listing all the IP Addresses for a user
         list_ipaddresses_after = PublicIPAddress.list(
-                                                      self.userapiclient,
-                                                      listall=self.services["listall"]
-                                                      )
+    

<TRUNCATED>

[2/4] git commit: updated refs/heads/master to e5efa70

Posted by ta...@apache.org.
CLOUDSTACK-7616: Fixed test_escalations_ipaddress.py - test suite should use its own vpc offering

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/0b9938ce
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/0b9938ce
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/0b9938ce

Branch: refs/heads/master
Commit: 0b9938ce40bd269639e91bf0e7bcfb36427cdaaa
Parents: 05913e3
Author: Gaurav Aradhye <ga...@clogeny.com>
Authored: Wed Sep 24 14:15:55 2014 +0530
Committer: SrikanteswaraRao Talluri <ta...@apache.org>
Committed: Fri Sep 26 14:43:50 2014 +0530

----------------------------------------------------------------------
 .../component/test_escalations_ipaddresses.py   | 5385 +++++++++---------
 1 file changed, 2728 insertions(+), 2657 deletions(-)
----------------------------------------------------------------------



[4/4] git commit: updated refs/heads/master to e5efa70

Posted by ta...@apache.org.
CLOUDSTACK-7603: Fixed test_escalations_network.py - test suite should use its own vpc offering

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/e5efa702
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/e5efa702
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/e5efa702

Branch: refs/heads/master
Commit: e5efa702bbd57a1855d68ea3df5c0aee3db85dcc
Parents: 0b9938c
Author: Gaurav Aradhye <ga...@clogeny.com>
Authored: Wed Sep 24 14:04:48 2014 +0530
Committer: SrikanteswaraRao Talluri <ta...@apache.org>
Committed: Fri Sep 26 14:46:43 2014 +0530

----------------------------------------------------------------------
 .../component/test_escalations_networks.py      | 3001 +++++++++---------
 1 file changed, 1567 insertions(+), 1434 deletions(-)
----------------------------------------------------------------------



[3/4] CLOUDSTACK-7603: Fixed test_escalations_network.py - test suite should use its own vpc offering

Posted by ta...@apache.org.
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/e5efa702/test/integration/component/test_escalations_networks.py
----------------------------------------------------------------------
diff --git a/test/integration/component/test_escalations_networks.py b/test/integration/component/test_escalations_networks.py
index 5fad43a..c0ab709 100644
--- a/test/integration/component/test_escalations_networks.py
+++ b/test/integration/component/test_escalations_networks.py
@@ -16,17 +16,31 @@
 # under the License.
 
 # Import Local Modules
-from marvin.cloudstackTestCase import *
-from marvin.cloudstackException import *
-from marvin.cloudstackAPI import *
-from marvin.sshClient import SshClient
-from marvin.lib.utils import *
-from marvin.lib.base import *
-from marvin.lib.common import *
-from marvin.lib.utils import checkVolumeSize
-from marvin.codes import SUCCESS
+from marvin.cloudstackTestCase import cloudstackTestCase
+from marvin.lib.utils import (cleanup_resources)
+from marvin.lib.base import (Account,
+                             VPC,
+                             Network,
+                             NetworkOffering,
+                             ServiceOffering,
+                             Vpn,
+                             Configurations,
+                             VpcOffering,
+                             PublicIPAddress,
+                             PrivateGateway,
+                             NetworkACL,
+                             VpnCustomerGateway,
+                             VirtualMachine,
+                             EgressFireWallRule,
+                             NetworkACLList,
+                             Zone)
+from marvin.lib.common import (get_zone,
+                               get_template,
+                               get_domain)
+from marvin.lib.utils import (validateList)
+from marvin.codes import PASS, FAIL
 from nose.plugins.attrib import attr
-from time import sleep
+
 
 class TestNetworks_1(cloudstackTestCase):
 
@@ -39,51 +53,59 @@ class TestNetworks_1(cloudstackTestCase):
             cls.test_data = cls.testClient.getParsedTestDataConfig()
             # Get Domain, Zone, Template
             cls.domain = get_domain(cls.api_client)
-            cls.zone = get_zone(cls.api_client, cls.testClient.getZoneForTests())
+            cls.zone = get_zone(
+                cls.api_client,
+                cls.testClient.getZoneForTests())
             cls.template = get_template(
-                                cls.api_client,
-                                cls.zone.id,
-                                cls.test_data["ostype"]
-                                )
+                cls.api_client,
+                cls.zone.id,
+                cls.test_data["ostype"]
+            )
             if cls.zone.localstorageenabled:
                 cls.storagetype = 'local'
-                cls.test_data["service_offerings"]["tiny"]["storagetype"] = 'local'
+                cls.test_data["service_offerings"][
+                    "tiny"]["storagetype"] = 'local'
             else:
                 cls.storagetype = 'shared'
-                cls.test_data["service_offerings"]["tiny"]["storagetype"] = 'shared'
+                cls.test_data["service_offerings"][
+                    "tiny"]["storagetype"] = 'shared'
 
             cls.test_data['mode'] = cls.zone.networktype
-            cls.test_data["virtual_machine"]["hypervisor"] = cls.testClient.getHypervisorInfo()
+            cls.test_data["virtual_machine"][
+                "hypervisor"] = cls.testClient.getHypervisorInfo()
             cls.test_data["virtual_machine"]["zoneid"] = cls.zone.id
             cls.test_data["virtual_machine"]["template"] = cls.template.id
             cls.test_data["network_without_acl"]["zoneid"] = cls.zone.id
             # Create Network offering
             cls.network_offering = NetworkOffering.create(
-                                        cls.api_client,
-                                        cls.test_data["network_offering_vlan"],
-                                        )
+                cls.api_client,
+                cls.test_data["network_offering_vlan"],
+            )
             # Enable Network offering
             cls.network_offering.update(cls.api_client, state='Enabled')
-            cls.test_data["network_without_acl"]["networkoffering"] = cls.network_offering.id
+            cls.test_data["network_without_acl"][
+                "networkoffering"] = cls.network_offering.id
             cls.service_offering = ServiceOffering.create(
-                                          cls.api_client,
-                                          cls.test_data["service_offerings"]["tiny"]
-                                          )
+                cls.api_client,
+                cls.test_data["service_offerings"]["tiny"]
+            )
             # Creating Disk offering, Service Offering and Account
             cls.account = Account.create(
-                                cls.api_client,
-                                cls.test_data["account"],
-                                domainid=cls.domain.id
-                                )
+                cls.api_client,
+                cls.test_data["account"],
+                domainid=cls.domain.id
+            )
             # Getting authentication for user in newly created Account
             cls.user = cls.account.user[0]
-            cls.userapiclient = cls.testClient.getUserApiClient(cls.user.username, cls.domain.name)
+            cls.userapiclient = cls.testClient.getUserApiClient(
+                cls.user.username,
+                cls.domain.name)
             cls.account_network = Network.create(
-                                                 cls.userapiclient,
-                                                 cls.test_data["network_without_acl"],
-                                                 cls.account.name,
-                                                 cls.account.domainid
-                                                 )
+                cls.userapiclient,
+                cls.test_data["network_without_acl"],
+                cls.account.name,
+                cls.account.domainid
+            )
             cls._cleanup.append(cls.account_network)
             cls._cleanup.append(cls.account)
             cls._cleanup.append(cls.service_offering)
@@ -114,10 +136,12 @@ class TestNetworks_1(cloudstackTestCase):
         """
         @summary: Function to verify expected and actual values
         Step1: Initializing return flag to True
-        Step2: Verifying length of expected and actual dictionaries is matching.
+        Step2: Verifying length of expected and actual dictionaries is
+               matching.
                If not matching returning false
         Step3: Listing all the keys from expected dictionary
-        Step4: Looping through each key from step2 and verifying expected and actual dictionaries have same value
+        Step4: Looping through each key from step2 and verifying expected
+               and actual dictionaries have same value
                If not making return flag to False
         Step5: returning the return flag after all the values are verified
         """
@@ -134,10 +158,10 @@ class TestNetworks_1(cloudstackTestCase):
                 return_flag = return_flag and True
             else:
                 return_flag = return_flag and False
-                self.debug("expected Value: %s, is not matching with actual value: %s" % (
-                                                                                          exp_val,
-                                                                                          act_val
-                                                                                          ))
+                self.debug(
+                    "expected Value: %s, is not matching with actual value: %s"
+                    %
+                    (exp_val, act_val))
         return return_flag
 
     @attr(tags=["advanced"], required_hardware="true")
@@ -147,117 +171,125 @@ class TestNetworks_1(cloudstackTestCase):
         @Steps
         Step1    : Listing the networks for a user
         Step2    : Verifying listed networks for account created at class level
-        Step3    : If number of networks is less than (pagesize  1), then creating them
+        Step3    : If number of networks is less than (pagesize  1), then
+                   creating them
         Step4    : Listing the networks again
-        Step5    : Verifying for the length of the networks that it is (pagesize  1)
+        Step5    : Verifying for the length of the networks that it is
+                   (pagesize  1)
         Step6    : Listing and verifying all the networks in page1
         Step7    : Listing and verifying all the networks in page2
-        Step8    : Verifying that on page 2 only 1 network is present and the network on page 2 is not present in page1
+        Step8    : Verifying that on page 2 only 1 network is present and
+                   the network on page 2 is not present in page1
         """
         list_zones = Zone.list(
-                                 self.userapiclient,
-                                 id=self.zone.id
-                               )
+            self.userapiclient,
+            id=self.zone.id
+        )
         status = validateList(list_zones)
         self.assertEquals(PASS, status[0], "No Zones found for a given id")
         self.test_data["network_without_acl"]["zoneid"] = list_zones[0].id
         # Listing the networks for a user
         list_networks_before = Network.list(
-                                            self.userapiclient,
-                                            listall=self.test_data["listall"],
-                                            type="Isolated"
-                                            )
+            self.userapiclient,
+            listall=self.test_data["listall"],
+            type="Isolated"
+        )
         # Verifying listed networks for account created at class level
         if list_networks_before is None:
             self.assertEqual(
-                             len(list_networks_before),
-                             0,
-                             "Network create failed at class level"
-                             )
-        # If number of networks is less than (pagesize  1), then creating network
+                len(list_networks_before),
+                0,
+                "Network create failed at class level"
+            )
+        # If number of networks is less than (pagesize  1), then creating
+        # network
         elif len(list_networks_before) == 1:
             for i in range(0, (self.test_data["pagesize"])):
                 network_created = Network.create(
-                                             self.userapiclient,
-                                             self.test_data["network_without_acl"],
-                                             )
+                    self.userapiclient,
+                    self.test_data["network_without_acl"],
+                )
                 self.cleanup.append(network_created)
                 self.assertIsNotNone(
-                                     network_created,
-                                     "Network is not created"
-                                     )
+                    network_created,
+                    "Network is not created"
+                )
                 # Creating expected and actual values dictionaries
                 expected_dict = {
-                                   "id":list_zones[0].id,
-                                   "name":self.test_data["network_without_acl"]["name"],
-                                   }
+                    "id": list_zones[0].id,
+                    "name": self.test_data["network_without_acl"]["name"],
+                }
                 actual_dict = {
-                                   "id":network_created.zoneid,
-                                   "name":network_created.name,
-                                   }
+                    "id": network_created.zoneid,
+                    "name": network_created.name,
+                }
                 network_status = self.__verify_values(
-                                                          expected_dict,
-                                                          actual_dict
-                                                          )
+                    expected_dict,
+                    actual_dict
+                )
                 self.assertEqual(
-                                 True,
-                                 network_status,
-                                 "Listed network details are not as expected"
-                                 )
+                    True,
+                    network_status,
+                    "Listed network details are not as expected"
+                )
         else:
             self.assertEqual(
-                             len(list_networks_before),
-                             1,
-                             "more than 1 network created at class level"
-                             )
+                len(list_networks_before),
+                1,
+                "more than 1 network created at class level"
+            )
         # Listing the networks
-        list_networks_after = Network.list(self.userapiclient, listall=self.test_data["listall"], type="Isolated")
+        list_networks_after = Network.list(
+            self.userapiclient,
+            listall=self.test_data["listall"],
+            type="Isolated")
         status = validateList(list_networks_after)
         self.assertEquals(PASS, status[0], "No networks found using list call")
         # Asserting for the length of the networks
         self.assertEqual(
-                         len(list_networks_after),
-                         (self.test_data["pagesize"] + 1),
-                         "Number of networks created is not matching expected"
-                         )
+            len(list_networks_after),
+            (self.test_data["pagesize"] + 1),
+            "Number of networks created is not matching expected"
+        )
         # Listing all the networks in page1
         list_networks_page1 = Network.list(
-                                             self.userapiclient,
-                                             listall=self.test_data["listall"],
-                                             page=1,
-                                             pagesize=self.test_data["pagesize"],
-                                             type="Isolated"
-                                             )
+            self.userapiclient,
+            listall=self.test_data["listall"],
+            page=1,
+            pagesize=self.test_data["pagesize"],
+            type="Isolated"
+        )
         status = validateList(list_networks_page1)
         self.assertEquals(PASS, status[0], "No networks found at page 1")
         self.assertEqual(
-                         len(list_networks_page1),
-                         self.test_data["pagesize"],
-                         "List network response is not matching with the page size length for page 1"
-                         )
+            len(list_networks_page1),
+            self.test_data["pagesize"],
+            "List network response is not matching with the page\
+                    size length for page 1")
         # Listing all the networks in page2
         list_networks_page2 = Network.list(
-                                             self.userapiclient,
-                                             listall=self.test_data["listall"],
-                                             page=2,
-                                             pagesize=self.test_data["pagesize"],
-                                             type="Isolated"
-                                             )
+            self.userapiclient,
+            listall=self.test_data["listall"],
+            page=2,
+            pagesize=self.test_data["pagesize"],
+            type="Isolated"
+        )
         status = validateList(list_networks_page2)
         self.assertEquals(PASS, status[0], "No networks found at page 2")
         self.assertEqual(
-                         len(list_networks_page2),
-                         1,
-                         "List network response is not matching with the page size length for page 2"
-                         )
+            len(list_networks_page2),
+            1,
+            "List network response is not matching with the page size\
+            length for page 2"
+        )
         network_page2 = list_networks_page2[0]
         for i in range(0, len(list_networks_page1)):
             network_page1 = list_networks_page1[i]
             self.assertNotEquals(
-                                 network_page2.id,
-                                 network_page1.id,
-                                 "Network listed in page 2 is also listed in page 1"
-                                 )
+                network_page2.id,
+                network_page1.id,
+                "Network listed in page 2 is also listed in page 1"
+            )
         return
 
     @attr(tags=["advanced"], required_hardware="true")
@@ -272,24 +304,28 @@ class TestNetworks_1(cloudstackTestCase):
         """
         # Create Network offering specifically sourcenat disabled
         network_offering_without_sourcenat = NetworkOffering.create(
-                                                                    self.apiClient,
-                                                                    self.test_data["network_offering_without_sourcenat"],
-                                                                    )
+            self.apiClient,
+            self.test_data["network_offering_without_sourcenat"],
+        )
         if network_offering_without_sourcenat is None:
             self.fail("Creation of network offering without sourcenat failed")
         self.cleanup.append(network_offering_without_sourcenat)
         # Enable network offering
-        network_offering_without_sourcenat.update(self.apiClient, state='Enabled')
-        self.test_data["network_without_acl"]["networkoffering"] = network_offering_without_sourcenat.id
+        network_offering_without_sourcenat.update(
+            self.apiClient,
+            state='Enabled')
+        self.test_data["network_without_acl"][
+            "networkoffering"] = network_offering_without_sourcenat.id
         # Network create call raise an exception
         with self.assertRaises(Exception):
             network_created = Network.create(
-                                             self.userapiclient,
-                                             self.test_data["network_without_acl"],
-                                             )
+                self.userapiclient,
+                self.test_data["network_without_acl"],
+            )
             if network_created is not None:
                 self.cleanup.append(network_created)
-        self.test_data["network_without_acl"]["networkoffering"] = self.network_offering.id
+        self.test_data["network_without_acl"][
+            "networkoffering"] = self.network_offering.id
         return
 
     @attr(tags=["advanced"], required_hardware="true")
@@ -303,8 +339,10 @@ class TestNetworks_1(cloudstackTestCase):
         Step4    : Verify count of VPCs created
         Step5    : Listing all the VPCs in page1
         Step6    : Listing all the VPCs in page2
-        Step7    : Verifying that on page 2 only 1 vpc is present and the vpc on page 2 is not present in page1
-        Step8    : Deleting a single vpc and verifying that vpc does not exists on page 2
+        Step7    : Verifying that on page 2 only 1 vpc is present and
+                   the vpc on page 2 is not present in page1
+        Step8    : Deleting a single vpc and verifying that vpc does
+                   not exists on page 2
         """
         # List VPC Offering
         vpc_offs_list = VpcOffering.list(self.userapiclient, isdefault="true")
@@ -314,95 +352,99 @@ class TestNetworks_1(cloudstackTestCase):
             vpc_offs = vpc_offs_list[0]
         # List VPCs
         vpc_list = VPC.list(
-                            self.userapiclient,
-                            listall=self.test_data["listall"]
-                            )
+            self.userapiclient,
+            listall=self.test_data["listall"]
+        )
         # verify no vpc is present for newly created user
         status = validateList(vpc_list)
         self.assertEquals(FAIL, status[0], "VPCs found for newly created user")
-        vpc_count_before = 0
         for i in range(0, (self.test_data["pagesize"] + 1)):
             vpc_1 = VPC.create(
-                               self.userapiclient,
-                               self.test_data["vpc"],
-                               vpcofferingid=vpc_offs.id,
-                               zoneid=self.zone.id,
-                               )
+                self.userapiclient,
+                self.test_data["vpc"],
+                vpcofferingid=vpc_offs.id,
+                zoneid=self.zone.id,
+            )
             if(i < (self.test_data["pagesize"])):
                 self.cleanup.append(vpc_1)
             # verify vpc is created and not none
             self.assertIsNotNone(vpc_1, "VPC is not created")
             # Verify VPC name with test data
             self.assertNotEquals(
- -1,
-                                 vpc_1.name.find(self.test_data["vpc"]["name"]),
-                                 "VPC name not matched"
-                                 )
+                -1,
+                vpc_1.name.find(self.test_data["vpc"]["name"]),
+                "VPC name not matched"
+            )
             # verify zone with test data
             self.assertEquals(
-                              self.zone.id,
-                              vpc_1.zoneid,
-                              "Zone is not matching in the vpc created"
-                              )
+                self.zone.id,
+                vpc_1.zoneid,
+                "Zone is not matching in the vpc created"
+            )
         # Asserting for the length of the VPCs
-        vpc_count_after = VPC.list(self.userapiclient, listall=self.test_data["listall"])
+        vpc_count_after = VPC.list(
+            self.userapiclient,
+            listall=self.test_data["listall"])
         status = validateList(vpc_count_after)
         self.assertEquals(PASS, status[0], "VPC list count is null")
         self.assertEqual(
-                         len(vpc_count_after),
-                         (self.test_data["pagesize"] + 1),
-                         "Number of VPCs created is not matching expected"
-                         )
+            len(vpc_count_after),
+            (self.test_data["pagesize"] + 1),
+            "Number of VPCs created is not matching expected"
+        )
         # Listing all the VPCs in page1
         list_vpcs_page1 = VPC.list(
-                                     self.userapiclient,
-                                     listall=self.test_data["listall"],
-                                     page=1,
-                                     pagesize=self.test_data["pagesize"]
-                                     )
+            self.userapiclient,
+            listall=self.test_data["listall"],
+            page=1,
+            pagesize=self.test_data["pagesize"]
+        )
         status = validateList(list_vpcs_page1)
         self.assertEquals(PASS, status[0], "No vpcs found in Page 1")
         self.assertEqual(
-                         len(list_vpcs_page1),
-                         self.test_data["pagesize"],
-                         "List vpc response is not matching with the page size length for page 1"
-                         )
+            len(list_vpcs_page1),
+            self.test_data["pagesize"],
+            "List vpc response is not matching with the page\
+            size length for page 1")
         # Listing all the vpcs in page2
         list_vpcs_page2 = VPC.list(
-                                     self.userapiclient,
-                                     listall=self.test_data["listall"],
-                                     page=2,
-                                     pagesize=self.test_data["pagesize"]
-                                     )
+            self.userapiclient,
+            listall=self.test_data["listall"],
+            page=2,
+            pagesize=self.test_data["pagesize"]
+        )
         status = validateList(list_vpcs_page2)
         self.assertEquals(PASS, status[0], "No vpc found in Page 2")
         self.assertEqual(
-                         1,
-                         len(list_vpcs_page2),
-                         "List VPCs response is not matching with the page size length for page 2"
-                         )
+            1,
+            len(list_vpcs_page2),
+            "List VPCs response is not matching with the\
+                    page size length for page 2"
+        )
         vpc_page2 = list_vpcs_page2[0]
-        # Verifying that on page 2 only 1 vpc is present and the vpc on page 2 is not present in page1
+        # Verifying that on page 2 only 1 vpc is present and the vpc on page 2
+        # is not present in page1
         for i in range(0, len(list_vpcs_page1)):
             vpc_page1 = list_vpcs_page1[i]
             self.assertNotEquals(
-                                 vpc_page2.id,
-                                 vpc_page1.id,
-                                 "VPC listed in page 2 is also listed in page 1"
-                                 )
-        # Deleting a single vpc and verifying that vpc does not exists on page 2
+                vpc_page2.id,
+                vpc_page1.id,
+                "VPC listed in page 2 is also listed in page 1"
+            )
+        # Deleting a single vpc and verifying that vpc does not exists on page
+        # 2
         VPC.delete(vpc_1, self.userapiclient)
         list_vpc_response = VPC.list(
-                                     self.userapiclient,
-                                     listall=self.test_data["listall"],
-                                     page=2,
-                                     pagesize=self.test_data["pagesize"]
-                                     )
+            self.userapiclient,
+            listall=self.test_data["listall"],
+            page=2,
+            pagesize=self.test_data["pagesize"]
+        )
         self.assertEqual(
-                        list_vpc_response,
-                        None,
-                        "vpc was not deleted"
-                        )
+            list_vpc_response,
+            None,
+            "vpc was not deleted"
+        )
         return
 
     @attr(tags=["advanced"], required_hardware="true")
@@ -423,33 +465,33 @@ class TestNetworks_1(cloudstackTestCase):
             vpc_offs = vpc_offs_list[0]
         # List VPCs for newly created user
         vpc_list = VPC.list(
-                            self.userapiclient,
-                            listall=self.test_data["listall"]
-                            )
+            self.userapiclient,
+            listall=self.test_data["listall"]
+        )
         # No VPCs should be present for newly created user
         status = validateList(vpc_list)
         self.assertEquals(FAIL, status[0], "VPCs found for newly created user")
         vpc_count_before = 0
         vpc_1 = VPC.create(
-                           self.userapiclient,
-                           self.test_data["vpc_network_domain"],
-                           vpcofferingid=vpc_offs.id,
-                           zoneid=self.zone.id,
-                           )
+            self.userapiclient,
+            self.test_data["vpc_network_domain"],
+            vpcofferingid=vpc_offs.id,
+            zoneid=self.zone.id,
+        )
         self.assertIsNotNone(vpc_1, "VPC is not created")
         self.cleanup.append(vpc_1)
         # List VPCs
         vpc_list = VPC.list(
-                            self.userapiclient,
-                            listall=self.test_data["listall"]
-                            )
+            self.userapiclient,
+            listall=self.test_data["listall"]
+        )
         status = validateList(vpc_list)
         self.assertEquals(PASS, status[0], "VPC is not created")
         self.assertEquals(
-                          vpc_count_before + 1,
-                          len(vpc_list),
-                          "VPC is not created"
-                          )
+            vpc_count_before + 1,
+            len(vpc_list),
+            "VPC is not created"
+        )
         return
 
     @attr(tags=["advanced"], required_hardware="true")
@@ -461,94 +503,117 @@ class TestNetworks_1(cloudstackTestCase):
         Step2    : Create network offering with default setting of vpc = false
         Step3    : List network offering
         Step4    : Verify that count is incremented by 1
-        Step5    : List network offering with additional parameter of vpc = true
+        Step5    : List network offering with additional parameter of
+                   vpc = true
         Step6    : Verify that its count is same as step 1
-        Step7    : List network offering with additional parameter of vpc = false
+        Step7    : List network offering with additional parameter of
+                   vpc = false
         Step8    : Verify that its count is same as step 3
         """
         # List all network offering
-        network_offering_before_count = NetworkOffering.list(self.userapiclient)
+        network_offering_before_count = NetworkOffering.list(
+            self.userapiclient)
         status = validateList(network_offering_before_count)
-        self.assertEquals(PASS, status[0], "Default network offering not present")
+        self.assertEquals(
+            PASS,
+            status[0],
+            "Default network offering not present")
         # List network offering for vpc = true
         network_offering_vpc_true_before_count = NetworkOffering.list(
-                                                                      self.userapiclient,
-                                                                      forvpc="true",
-                                                                      zoneid=self.zone.id,
-                                                                      guestiptype=self.test_data["network_offering_vlan"]["guestiptype"],
-                                                                      supportedServices="SourceNat",
-                                                                      specifyvlan=self.test_data["network_offering_vlan"]["specifyvlan"],
-                                                                      state="Enabled"
-                                                                      )
+            self.userapiclient,
+            forvpc="true",
+            zoneid=self.zone.id,
+            guestiptype=self.test_data["network_offering_vlan"]["guestiptype"],
+            supportedServices="SourceNat",
+            specifyvlan=self.test_data["network_offering_vlan"]["specifyvlan"],
+            state="Enabled"
+        )
         status = validateList(network_offering_vpc_true_before_count)
-        self.assertEquals(PASS, status[0], "Default network offering not present for vpc = true")
+        self.assertEquals(
+            PASS,
+            status[0],
+            "Default network offering not present for vpc = true")
         # List network offering
         network_offering_vpc_false_before_count = NetworkOffering.list(
-                                                                      self.userapiclient,
-                                                                      forvpc="false",
-                                                                      zoneid=self.zone.id,
-                                                                      guestiptype=self.test_data["network_offering_vlan"]["guestiptype"],
-                                                                      supportedServices="SourceNat",
-                                                                      specifyvlan=self.test_data["network_offering_vlan"]["specifyvlan"],
-                                                                      state="Enabled"
-                                                                       )
+            self.userapiclient,
+            forvpc="false",
+            zoneid=self.zone.id,
+            guestiptype=self.test_data["network_offering_vlan"]["guestiptype"],
+            supportedServices="SourceNat",
+            specifyvlan=self.test_data["network_offering_vlan"]["specifyvlan"],
+            state="Enabled"
+        )
         status = validateList(network_offering_vpc_false_before_count)
-        self.assertEquals(PASS, status[0], "Default network offering not present for vpc = false")
+        self.assertEquals(
+            PASS,
+            status[0],
+            "Default network offering not present for vpc = false")
         # Create network Offering
         network_offering = NetworkOffering.create(
-                                    self.apiClient,
-                                    self.test_data["network_offering_vlan"],
-                                    )
-        self.assertIsNotNone(network_offering, "Network offering is not created")
+            self.apiClient,
+            self.test_data["network_offering_vlan"],
+        )
+        self.assertIsNotNone(
+            network_offering,
+            "Network offering is not created")
         # Enable Network offering
         network_offering.update(self.apiClient, state='Enabled')
         self.cleanup.append(network_offering)
         # List network offering
         network_offering_after_count = NetworkOffering.list(self.userapiclient)
         status = validateList(network_offering_after_count)
-        self.assertEquals(PASS, status[0], "Network Offering list results in null")
+        self.assertEquals(
+            PASS,
+            status[0],
+            "Network Offering list results in null")
         # Verify that count is incremented by 1
         self.assertEquals(
-                          len(network_offering_before_count) + 1,
-                          len(network_offering_after_count),
-                          "Network offering is not created"
-                          )
+            len(network_offering_before_count) + 1,
+            len(network_offering_after_count),
+            "Network offering is not created"
+        )
         # List network offering with additional parameter of vpc = true
         network_offering_vpc_true_after_count = NetworkOffering.list(
-                                                                      self.userapiclient,
-                                                                      forvpc="true",
-                                                                      zoneid=self.zone.id,
-                                                                      guestiptype=self.test_data["network_offering_vlan"]["guestiptype"],
-                                                                      supportedServices="SourceNat",
-                                                                      specifyvlan=self.test_data["network_offering_vlan"]["specifyvlan"],
-                                                                      state="Enabled"
-                                                                     )
+            self.userapiclient,
+            forvpc="true",
+            zoneid=self.zone.id,
+            guestiptype=self.test_data["network_offering_vlan"]["guestiptype"],
+            supportedServices="SourceNat",
+            specifyvlan=self.test_data["network_offering_vlan"]["specifyvlan"],
+            state="Enabled"
+        )
         status = validateList(network_offering_vpc_true_after_count)
-        self.assertEquals(PASS, status[0], "Network Offering list results in null")
+        self.assertEquals(
+            PASS,
+            status[0],
+            "Network Offering list results in null")
         # Verify that its count is same as step 1
         self.assertEquals(
-                          len(network_offering_vpc_true_before_count),
-                          len(network_offering_vpc_true_after_count),
-                          "Default Network offering is created with vpc as true"
-                          )
+            len(network_offering_vpc_true_before_count),
+            len(network_offering_vpc_true_after_count),
+            "Default Network offering is created with vpc as true"
+        )
         # List network offering with additional parameter of vpc = false
         network_offering_vpc_false_after_count = NetworkOffering.list(
-                                                                      self.userapiclient,
-                                                                      forvpc="false",
-                                                                      zoneid=self.zone.id,
-                                                                      guestiptype=self.test_data["network_offering_vlan"]["guestiptype"],
-                                                                      supportedServices="SourceNat",
-                                                                      specifyvlan=self.test_data["network_offering_vlan"]["specifyvlan"],
-                                                                      state="Enabled"
-                                                                      )
+            self.userapiclient,
+            forvpc="false",
+            zoneid=self.zone.id,
+            guestiptype=self.test_data["network_offering_vlan"]["guestiptype"],
+            supportedServices="SourceNat",
+            specifyvlan=self.test_data["network_offering_vlan"]["specifyvlan"],
+            state="Enabled"
+        )
         status = validateList(network_offering_vpc_false_after_count)
-        self.assertEquals(PASS, status[0], "Network Offering list results in null")
+        self.assertEquals(
+            PASS,
+            status[0],
+            "Network Offering list results in null")
         # Verify that its count is same as step 3
         self.assertEquals(
-                          len(network_offering_vpc_false_before_count) + 1,
-                          len(network_offering_vpc_false_after_count),
-                          "Default Network offering is not created with vpc as false"
-                          )
+            len(network_offering_vpc_false_before_count) + 1,
+            len(network_offering_vpc_false_after_count),
+            "Default Network offering is not created with vpc as false"
+        )
         return
 
     @attr(tags=["advanced"], required_hardware="true")
@@ -562,7 +627,8 @@ class TestNetworks_1(cloudstackTestCase):
         Step4    : List VPC and verify that count is increased by 1
         Step5    : Create network
         Step6    : List VPCs for specific network created in vpc
-        Step7    : Verify vpc name matches for newly created vpc name and name from vpc list
+        Step7    : Verify vpc name matches for newly created vpc name
+                   and name from vpc list
         """
         # List VPC Offering
         vpc_offs_list = VpcOffering.list(self.userapiclient,
@@ -574,106 +640,119 @@ class TestNetworks_1(cloudstackTestCase):
             vpc_offs = vpc_offs_list[0]
         # List VPCs for newly created user
         vpc_list = VPC.list(
-                            self.userapiclient,
-                            listall=self.test_data["listall"]
-                            )
+            self.userapiclient,
+            listall=self.test_data["listall"]
+        )
         # No VPCs should be present for newly created user
         status = validateList(vpc_list)
         self.assertEquals(FAIL, status[0], "VPCs found for newly created user")
         vpc_count_before = 0
         vpc_1 = VPC.create(
-                           self.userapiclient,
-                           self.test_data["vpc"],
-                           vpcofferingid=vpc_offs.id,
-                           zoneid=self.zone.id,
-                           )
+            self.userapiclient,
+            self.test_data["vpc"],
+            vpcofferingid=vpc_offs.id,
+            zoneid=self.zone.id,
+        )
         self.assertIsNotNone(vpc_1, "VPC is not created")
         # List VPCs
         vpc_list = VPC.list(
-                            self.userapiclient,
-                            listall=self.test_data["listall"]
-                            )
+            self.userapiclient,
+            listall=self.test_data["listall"]
+        )
         status = validateList(vpc_list)
         self.assertEquals(PASS, status[0], "VPC is not created")
         self.assertEquals(
-                          vpc_count_before + 1,
-                          len(vpc_list),
-                          "VPC is not created"
-                          )
+            vpc_count_before + 1,
+            len(vpc_list),
+            "VPC is not created"
+        )
         # Listing the networks for a user
-        list_networks_before = Network.list(self.userapiclient, listall=self.test_data["listall"], type="Isolated")
+        list_networks_before = Network.list(
+            self.userapiclient,
+            listall=self.test_data["listall"],
+            type="Isolated")
         # Verifying listed networks for account created at class level
-        self.assertIsNotNone(list_networks_before, "Network create failed at class level")
+        self.assertIsNotNone(
+            list_networks_before,
+            "Network create failed at class level")
         # List network offering for vpc = true
         network_offering_vpc_true_list = NetworkOffering.list(
-                                                               self.userapiclient,
-                                                               forvpc="true",
-                                                               zoneid=self.zone.id,
-                                                               guestiptype=self.test_data["network_offering_vlan"]["guestiptype"],
-                                                               supportedServices="SourceNat",
-                                                               specifyvlan=self.test_data["network_offering_vlan"]["specifyvlan"],
-                                                               state="Enabled"
-                                                               )
+            self.userapiclient,
+            forvpc="true",
+            zoneid=self.zone.id,
+            guestiptype=self.test_data["network_offering_vlan"]["guestiptype"],
+            supportedServices="SourceNat",
+            specifyvlan=self.test_data["network_offering_vlan"]["specifyvlan"],
+            state="Enabled"
+        )
         status = validateList(network_offering_vpc_true_list)
-        self.assertEquals(PASS, status[0], "Default network offering not present for vpc = true")
+        self.assertEquals(
+            PASS,
+            status[0],
+            "Default network offering not present for vpc = true")
         # Listing networks in VPC
         list_networks_in_vpc = Network.list(self.userapiclient,
                                             vpcid=vpc_1.id,
                                             type="Isolated"
                                             )
-        self.assertIsNone(list_networks_in_vpc, "Networks found for newly created VPC")
+        self.assertIsNone(
+            list_networks_in_vpc,
+            "Networks found for newly created VPC")
         # If number of networks is 1, then creating network
         if len(list_networks_before) == 1:
-                network_created = Network.create(
-                                                 self.userapiclient,
-                                                 self.test_data["network_without_acl"],
-                                                 networkofferingid=network_offering_vpc_true_list[0].id,
-                                                 vpcid=vpc_1.id,
-                                                 gateway=self.test_data["ntwk"]["gateway"],
-                                                 netmask=self.test_data["ntwk"]["netmask"],
-                                                 domainid=self.domain.id,
-                                                 accountid=self.account.name,
-                                                 )
-                self.assertIsNotNone(
-                                     network_created,
-                                     "Network is not created"
-                                     )
-                self.cleanup.append(network_created)
-                self.cleanup.append(vpc_1)
-                # Creating expected and actual values dictionaries
-                expected_dict = {
-                                   "id":self.test_data["network_without_acl"]["zoneid"],
-                                   "name":self.test_data["network_without_acl"]["name"],
-                                   }
-                actual_dict = {
-                                   "id":network_created.zoneid,
-                                   "name":network_created.name,
-                                   }
-                network_status = self.__verify_values(
-                                                          expected_dict,
-                                                          actual_dict
-                                                          )
-                self.assertEqual(
-                                 True,
-                                 network_status,
-                                 "Listed network details are not as expected"
-                                 )
+            network_created = Network.create(
+                self.userapiclient,
+                self.test_data["network_without_acl"],
+                networkofferingid=network_offering_vpc_true_list[0].id,
+                vpcid=vpc_1.id,
+                gateway=self.test_data["ntwk"]["gateway"],
+                netmask=self.test_data["ntwk"]["netmask"],
+                domainid=self.domain.id,
+                accountid=self.account.name,
+            )
+            self.assertIsNotNone(
+                network_created,
+                "Network is not created"
+            )
+            self.cleanup.append(network_created)
+            self.cleanup.append(vpc_1)
+            # Creating expected and actual values dictionaries
+            expected_dict = {
+                "id": self.test_data["network_without_acl"]["zoneid"],
+                "name": self.test_data["network_without_acl"]["name"],
+            }
+            actual_dict = {
+                "id": network_created.zoneid,
+                "name": network_created.name,
+            }
+            network_status = self.__verify_values(
+                expected_dict,
+                actual_dict
+            )
+            self.assertEqual(
+                True,
+                network_status,
+                "Listed network details are not as expected"
+            )
         else:
             self.assertEqual(
-                             len(list_networks_before),
-                             1,
-                             "more than 1 network created at class level"
-                             )
+                len(list_networks_before),
+                1,
+                "more than 1 network created at class level"
+            )
         # Listing the networks
-        list_networks_after = Network.list(self.userapiclient, listall=self.test_data["listall"], type="Isolated")
+        list_networks_after = Network.list(
+            self.userapiclient,
+            listall=self.test_data["listall"],
+            type="Isolated")
         status = validateList(list_networks_after)
         self.assertEquals(PASS, status[0], "No networks found using list call")
         # Asserting for the length of the networks
         self.assertEqual(
-                         2,
-                         len(list_networks_after),
-                         "Number of networks created is not matching expected"
-                         )
+            2,
+            len(list_networks_after),
+            "Number of networks created is not matching expected"
+        )
         # Listing networks in VPC after creation of network
         list_networks_in_vpc = Network.list(self.userapiclient,
                                             vpcid=vpc_1.id,
@@ -683,24 +762,24 @@ class TestNetworks_1(cloudstackTestCase):
         self.assertEquals(PASS, status[0], "No networks found in vpc")
         # Asserting for the length of the networks
         self.assertEqual(
-                         1,
-                         len(list_networks_in_vpc),
-                         "Number of networks created in vpc is not matching expected"
-                         )
+            1,
+            len(list_networks_in_vpc),
+            "Number of networks created in vpc is not matching expected"
+        )
         # List VPCs for specific network created in vpc
         vpc_list = VPC.list(
-                             self.userapiclient,
-                             id=network_created.vpcid
-                             )
+            self.userapiclient,
+            id=network_created.vpcid
+        )
         # verify no vpc is present for newly created user
         status = validateList(vpc_list)
         self.assertEquals(PASS, status[0], "VPCs not found.")
         # verify vpc name matches for newly created vpc name and vpc list name
         self.assertEqual(
-                         vpc_1.name,
-                         vpc_list[0].name,
-                         "VPC names not matching"
-                         )
+            vpc_1.name,
+            vpc_list[0].name,
+            "VPC names not matching"
+        )
         return
 
     @attr(tags=["advanced"], required_hardware="true")
@@ -714,91 +793,99 @@ class TestNetworks_1(cloudstackTestCase):
         Step4    : Verify network is deleted
         """
         # Listing the networks for a user
-        list_networks_before = Network.list(self.userapiclient, listall=self.test_data["listall"], type="Isolated")
+        list_networks_before = Network.list(
+            self.userapiclient,
+            listall=self.test_data["listall"],
+            type="Isolated")
         # Verifying listed networks for account created at class level
-        self.assertIsNotNone(list_networks_before, "Network create failed at class level")
+        self.assertIsNotNone(
+            list_networks_before,
+            "Network create failed at class level")
         # List network offering for vpc = false
         network_offering_vpc_false_list = NetworkOffering.list(
-                                                               self.userapiclient,
-                                                               forvpc="false",
-                                                               zoneid=self.zone.id,
-                                                               guestiptype=self.test_data["network_offering_vlan"]["guestiptype"],
-                                                               supportedServices="SourceNat",
-                                                               specifyvlan=self.test_data["network_offering_vlan"]["specifyvlan"],
-                                                               state="Enabled"
-                                                               )
+            self.userapiclient,
+            forvpc="false",
+            zoneid=self.zone.id,
+            guestiptype=self.test_data["network_offering_vlan"]["guestiptype"],
+            supportedServices="SourceNat",
+            specifyvlan=self.test_data["network_offering_vlan"]["specifyvlan"],
+            state="Enabled"
+        )
         status = validateList(network_offering_vpc_false_list)
-        self.assertEquals(PASS, status[0], "Default network offering not present for vpc = false")
+        self.assertEquals(
+            PASS,
+            status[0],
+            "Default network offering not present for vpc = false")
         # If number of networks is 1, then creating network
         if len(list_networks_before) == 1:
-                network_created = Network.create(
-                                                 self.userapiclient,
-                                                 self.test_data["network_without_acl"],
-                                                 networkofferingid=network_offering_vpc_false_list[0].id,
-                                             )
-                self.assertIsNotNone(
-                                     network_created,
-                                     "Network is not created"
-                                     )
-                # Creating expected and actual values dictionaries
-                expected_dict = {
-                                   "id":self.test_data["network_without_acl"]["zoneid"],
-                                   "name":self.test_data["network_without_acl"]["name"],
-                                   }
-                actual_dict = {
-                                   "id":network_created.zoneid,
-                                   "name":network_created.name,
-                                   }
-                network_status = self.__verify_values(
-                                                          expected_dict,
-                                                          actual_dict
-                                                          )
-                self.assertEqual(
-                                 True,
-                                 network_status,
-                                 "Listed network details are not as expected"
-                                 )
+            network_created = Network.create(
+                self.userapiclient,
+                self.test_data["network_without_acl"],
+                networkofferingid=network_offering_vpc_false_list[0].id,
+            )
+            self.assertIsNotNone(
+                network_created,
+                "Network is not created"
+            )
+            # Creating expected and actual values dictionaries
+            expected_dict = {
+                "id": self.test_data["network_without_acl"]["zoneid"],
+                "name": self.test_data["network_without_acl"]["name"],
+            }
+            actual_dict = {
+                "id": network_created.zoneid,
+                "name": network_created.name,
+            }
+            network_status = self.__verify_values(
+                expected_dict,
+                actual_dict
+            )
+            self.assertEqual(
+                True,
+                network_status,
+                "Listed network details are not as expected"
+            )
         else:
             self.assertEqual(
-                             len(list_networks_before),
-                             1,
-                             "more than 1 network created at class level"
-                             )
+                len(list_networks_before),
+                1,
+                "more than 1 network created at class level"
+            )
         # Listing the networks
         list_networks_after = Network.list(
-                                           self.userapiclient,
-                                           listall=self.test_data["listall"],
-                                           type="Isolated"
-                                           )
+            self.userapiclient,
+            listall=self.test_data["listall"],
+            type="Isolated"
+        )
         status = validateList(list_networks_after)
         self.assertEquals(PASS, status[0], "No networks found using list call")
         # Asserting for the length of the networks
         self.assertEqual(
-                         2,
-                         len(list_networks_after),
-                         "Number of networks created is not matching expected"
-                         )
+            2,
+            len(list_networks_after),
+            "Number of networks created is not matching expected"
+        )
         # Delete Network
         Network.delete(network_created, self.userapiclient)
         # List Networks
         list_networks_after_delete = Network.list(
-                                                  self.userapiclient,
-                                                  listall=self.test_data["listall"],
-                                                  type="Isolated"
-                                                  )
+            self.userapiclient,
+            listall=self.test_data["listall"],
+            type="Isolated"
+        )
         status = validateList(list_networks_after_delete)
         self.assertEquals(PASS, status[0], "No networks found using list call")
         self.assertEqual(
-                         1,
-                         len(list_networks_after_delete),
-                         "Number of networks created is not matching expected"
-                         )
+            1,
+            len(list_networks_after_delete),
+            "Number of networks created is not matching expected"
+        )
         # Verify deleted network is not present
         self.assertNotEquals(
-                             network_created.id,
-                             list_networks_after_delete[0].id,
-                             "Deleted network present"
-                             )
+            network_created.id,
+            list_networks_after_delete[0].id,
+            "Deleted network present"
+        )
         return
 
     @attr(tags=["advanced"], required_hardware="true")
@@ -812,65 +899,76 @@ class TestNetworks_1(cloudstackTestCase):
         Step4    : Verify network is updated
         """
         # Listing the networks for a user
-        list_networks_before = Network.list(self.userapiclient, listall=self.test_data["listall"], type="Isolated")
+        list_networks_before = Network.list(
+            self.userapiclient,
+            listall=self.test_data["listall"],
+            type="Isolated")
         # Verifying listed networks for account created at class level
-        self.assertIsNotNone(list_networks_before, "Network create failed at class level")
+        self.assertIsNotNone(
+            list_networks_before,
+            "Network create failed at class level")
         self.assertEquals(
-                          1,
-                          len(list_networks_before),
-                          "More than 1 network created at class level"
-                          )
+            1,
+            len(list_networks_before),
+            "More than 1 network created at class level"
+        )
         # List network offering for vpc = false
         network_offering_vpc_false_list = NetworkOffering.list(
-                                                               self.userapiclient,
-                                                               forvpc="false",
-                                                               zoneid=self.zone.id,
-                                                               guestiptype=self.test_data["network_offering_vlan"]["guestiptype"],
-                                                               supportedServices="SourceNat",
-                                                               specifyvlan=self.test_data["network_offering_vlan"]["specifyvlan"],
-                                                               state="Enabled"
-                                                               )
+            self.userapiclient,
+            forvpc="false",
+            zoneid=self.zone.id,
+            guestiptype=self.test_data["network_offering_vlan"]["guestiptype"],
+            supportedServices="SourceNat",
+            specifyvlan=self.test_data["network_offering_vlan"]["specifyvlan"],
+            state="Enabled"
+        )
         status = validateList(network_offering_vpc_false_list)
-        self.assertEquals(PASS, status[0], "Default network offering not present for vpc = false")
+        self.assertEquals(
+            PASS,
+            status[0],
+            "Default network offering not present for vpc = false")
         # creating network
         network_created = Network.create(
-                                         self.userapiclient,
-                                         self.test_data["network_without_acl"],
-                                         networkofferingid=network_offering_vpc_false_list[0].id,
-                                         )
+            self.userapiclient,
+            self.test_data["network_without_acl"],
+            networkofferingid=network_offering_vpc_false_list[0].id,
+        )
         self.assertIsNotNone(
-                             network_created,
-                             "Network is not created"
-                             )
+            network_created,
+            "Network is not created"
+        )
         self.cleanup.append(network_created)
         # Creating expected and actual values dictionaries
         expected_dict = {
-                           "id":self.test_data["network_without_acl"]["zoneid"],
-                           "name":self.test_data["network_without_acl"]["name"],
-                           }
+            "id": self.test_data["network_without_acl"]["zoneid"],
+            "name": self.test_data["network_without_acl"]["name"],
+        }
         actual_dict = {
-                           "id":network_created.zoneid,
-                           "name":network_created.name,
-                           }
+            "id": network_created.zoneid,
+            "name": network_created.name,
+        }
         network_status = self.__verify_values(
-                                                  expected_dict,
-                                                  actual_dict
-                                                  )
+            expected_dict,
+            actual_dict
+        )
         self.assertEqual(
-                         True,
-                         network_status,
-                         "Listed network details are not as expected"
-                         )
+            True,
+            network_status,
+            "Listed network details are not as expected"
+        )
         # Listing the networks
-        list_networks_after = Network.list(self.userapiclient, listall=self.test_data["listall"], type="Isolated")
+        list_networks_after = Network.list(
+            self.userapiclient,
+            listall=self.test_data["listall"],
+            type="Isolated")
         status = validateList(list_networks_after)
         self.assertEquals(PASS, status[0], "No networks found using list call")
         # Asserting for the length of the networks
         self.assertEqual(
-                         2,
-                         len(list_networks_after),
-                         "Number of networks created is not matching expected"
-                         )
+            2,
+            len(list_networks_after),
+            "Number of networks created is not matching expected"
+        )
         # Update Network
         network_updated = Network.update(network_created,
                                          self.userapiclient,
@@ -879,34 +977,37 @@ class TestNetworks_1(cloudstackTestCase):
                                          networkdomain="cs13cloud.internal.new"
                                          )
         # List Networks
-        list_networks_after_update = Network.list(self.userapiclient, listall=self.test_data["listall"], type="Isolated")
+        list_networks_after_update = Network.list(
+            self.userapiclient,
+            listall=self.test_data["listall"],
+            type="Isolated")
         status = validateList(list_networks_after_update)
         self.assertEquals(PASS, status[0], "No networks found using list call")
         self.assertEqual(
-                         2,
-                         len(list_networks_after_update),
-                         "Number of networks created is not matching expected"
-                         )
+            2,
+            len(list_networks_after_update),
+            "Number of networks created is not matching expected"
+        )
         # Creating expected and actual values dictionaries
         expected_dict = {
-                         "name":"NewNetworkName",
-                         "displaytext":"NewNetworkDisplayText",
-                         "networkdomain":"cs13cloud.internal.new"
-                         }
+            "name": "NewNetworkName",
+            "displaytext": "NewNetworkDisplayText",
+            "networkdomain": "cs13cloud.internal.new"
+        }
         actual_dict = {
-                        "name":network_updated.name,
-                        "displaytext":network_updated.displaytext,
-                        "networkdomain":network_updated.networkdomain
-                        }
+            "name": network_updated.name,
+            "displaytext": network_updated.displaytext,
+            "networkdomain": network_updated.networkdomain
+        }
         network_status = self.__verify_values(
-                                              expected_dict,
-                                              actual_dict
-                                              )
+            expected_dict,
+            actual_dict
+        )
         self.assertEqual(
-                         True,
-                         network_status,
-                         "Listed network details are not as expected"
-                         )
+            True,
+            network_status,
+            "Listed network details are not as expected"
+        )
         return
 
     @attr(tags=["advanced"], required_hardware="true")
@@ -920,114 +1021,122 @@ class TestNetworks_1(cloudstackTestCase):
         Step4    : Verify list Virtual machines and pagination
         """
         # Listing the networks for a user
-        list_networks_before = Network.list(self.userapiclient, listall=self.test_data["listall"], type="Isolated")
+        list_networks_before = Network.list(
+            self.userapiclient,
+            listall=self.test_data["listall"],
+            type="Isolated")
         # Verifying listed networks for account created at class level
-        self.assertIsNotNone(list_networks_before, "Network create failed at class level")
+        self.assertIsNotNone(
+            list_networks_before,
+            "Network create failed at class level")
         # Create Virtual Machine
         # Listing all the instances for a user
-        list_instances_before = VirtualMachine.list(self.userapiclient, listall=self.test_data["listall"])
+        list_instances_before = VirtualMachine.list(
+            self.userapiclient,
+            listall=self.test_data["listall"])
         # Verifying listed instances for account created at class level
         self.assertIsNone(
-                          list_instances_before,
-                          "Virtual Machine already exists for newly created user"
-                          )
-        # If number of instances are less than (pagesize  1), then creating them
+            list_instances_before,
+            "Virtual Machine already exists for newly created user"
+        )
+        # If number of instances are less than (pagesize  1), then creating
+        # them
         for i in range(0, (self.test_data["pagesize"] + 1)):
             vm_created = VirtualMachine.create(
-                                               self.userapiclient,
-                                               self.test_data["virtual_machine"],
-                                               accountid=self.account.name,
-                                               domainid=self.account.domainid,
-                                               networkids=list_networks_before[0].id,
-                                               serviceofferingid=self.service_offering.id,
-                                               )
+                self.userapiclient,
+                self.test_data["virtual_machine"],
+                accountid=self.account.name,
+                domainid=self.account.domainid,
+                networkids=list_networks_before[0].id,
+                serviceofferingid=self.service_offering.id,
+            )
             self.assertIsNotNone(
-                                 vm_created,
-                                 "VM creation failed"
-                                 )
+                vm_created,
+                "VM creation failed"
+            )
             if(i < (self.test_data["pagesize"])):
                 self.cleanup.append(vm_created)
 
             self.assertEqual(
-                             self.test_data["virtual_machine"]["displayname"],
-                             vm_created.displayname,
-                             "Newly created VM name and the test data VM name are not matching"
-                             )
+                self.test_data["virtual_machine"]["displayname"],
+                vm_created.displayname,
+                "Newly created VM name and the test data VM\
+                        name are not matching")
         # Listing all the instances again after creating VM's
         list_instances_after = VirtualMachine.list(
-                                                   self.userapiclient,
-                                                   listall=self.test_data["listall"],
-                                                   networkid=list_networks_before[0].id
-                                                   )
+            self.userapiclient,
+            listall=self.test_data["listall"],
+            networkid=list_networks_before[0].id
+        )
         status = validateList(list_instances_after)
         self.assertEquals(
-                          PASS,
-                          status[0],
-                          "Listing of instances after creation failed"
-                          )
+            PASS,
+            status[0],
+            "Listing of instances after creation failed"
+        )
         # Verifying the length of the instances is (page size  1)
         self.assertEqual(
-                         len(list_instances_after),
-                         (self.test_data["pagesize"] + 1),
-                         "Number of instances created is not matching as expected"
-                         )
+            len(list_instances_after),
+            (self.test_data["pagesize"] + 1),
+            "Number of instances created is not matching as expected"
+        )
         # Listing all the volumes in page1
         list_instances_page1 = VirtualMachine.list(
-                                                   self.userapiclient,
-                                                   listall=self.test_data["listall"],
-                                                   page=1,
-                                                   pagesize=self.test_data["pagesize"],
-                                                   networkid=list_networks_before[0].id
-                                                   )
+            self.userapiclient,
+            listall=self.test_data["listall"],
+            page=1,
+            pagesize=self.test_data["pagesize"],
+            networkid=list_networks_before[0].id
+        )
         status = validateList(list_instances_page1)
         self.assertEquals(
-                          PASS,
-                          status[0],
-                          "Listing of instances in page1 failed"
-                          )
+            PASS,
+            status[0],
+            "Listing of instances in page1 failed"
+        )
         # Verifying that the length of the instances in page 1 is (page size)
         self.assertEqual(
-                         self.test_data["pagesize"],
-                         len(list_instances_page1),
-                         "List VM response is not matching with the page size length for page 1"
-                         )
-       # Listing all the VM's in page2
+            self.test_data["pagesize"],
+            len(list_instances_page1),
+            "List VM response is not matching with the\
+                    page size length for page 1")
+        # Listing all the VM's in page2
         list_instances_page2 = VirtualMachine.list(
-                                                   self.userapiclient,
-                                                   listall=self.test_data["listall"],
-                                                   page=2,
-                                                   pagesize=self.test_data["pagesize"],
-                                                   networkid=list_networks_before[0].id
-                                                   )
+            self.userapiclient,
+            listall=self.test_data["listall"],
+            page=2,
+            pagesize=self.test_data["pagesize"],
+            networkid=list_networks_before[0].id
+        )
         status = validateList(list_instances_page2)
         self.assertEquals(
-                          PASS,
-                          status[0],
-                          "Listing of instances in page2 failed"
-                          )
+            PASS,
+            status[0],
+            "Listing of instances in page2 failed"
+        )
         # Verifying that the length of the VM's in page 2 is 1
         self.assertEqual(
-                         1,
-                         len(list_instances_page2),
-                         "List VM response is not matching with the page size length for page 2"
-                         )
-        instance_page2 = list_instances_page2[0]
+            1,
+            len(list_instances_page2),
+            "List VM response is not matching with the\
+                    page size length for page 2"
+        )
         # Deleting a single VM
         VirtualMachine.delete(vm_created, self.apiClient)
         # Listing the VM's in page 2
         list_instance_response = VirtualMachine.list(
-                                                     self.userapiclient,
-                                                     listall=self.test_data["listall"],
-                                                     page=2,
-                                                     pagesize=self.test_data["pagesize"],
-                                                     networkid=list_networks_before[0].id
-                                                     )
+            self.userapiclient,
+            listall=self.test_data["listall"],
+            page=2,
+            pagesize=self.test_data["pagesize"],
+            networkid=list_networks_before[0].id
+        )
         # verifying that VM does not exists on page 2
         self.assertEqual(
-                        list_instance_response,
-                        None,
-                        "VM was not deleted"
-                        )
+            list_instance_response,
+            None,
+            "VM was not deleted"
+        )
         return
 
     @attr(tags=["advanced"], required_hardware="true")
@@ -1041,7 +1150,8 @@ class TestNetworks_1(cloudstackTestCase):
         Step4    : List VPC and verify that count is increased by 1
         Step5    : Create network
         Step6    : List Networks in created vpc
-        Step7    : Verify network name matches for newly created network name and name from network list
+        Step7    : Verify network name matches for newly created network name
+                   and name from network list
         """
         # List VPC Offering
         vpc_offs_list = VpcOffering.list(self.userapiclient, isdefault="true")
@@ -1051,113 +1161,125 @@ class TestNetworks_1(cloudstackTestCase):
             vpc_offs = vpc_offs_list[0]
         # List VPCs for newly created user
         vpc_list = VPC.list(
-                            self.userapiclient,
-                            listall=self.test_data["listall"]
-                            )
+            self.userapiclient,
+            listall=self.test_data["listall"]
+        )
         # No VPCs should be present for newly created user
         status = validateList(vpc_list)
         self.assertEquals(FAIL, status[0], "VPCs found for newly created user")
         vpc_count_before = 0
         vpc_1 = VPC.create(
-                           self.userapiclient,
-                           self.test_data["vpc"],
-                           vpcofferingid=vpc_offs.id,
-                           zoneid=self.zone.id,
-                           )
+            self.userapiclient,
+            self.test_data["vpc"],
+            vpcofferingid=vpc_offs.id,
+            zoneid=self.zone.id,
+        )
         self.assertIsNotNone(vpc_1, "VPC is not created")
         # List VPCs
         vpc_list = VPC.list(
-                            self.userapiclient,
-                            listall=self.test_data["listall"]
-                            )
+            self.userapiclient,
+            listall=self.test_data["listall"]
+        )
         status = validateList(vpc_list)
         self.assertEquals(PASS, status[0], "VPC is not created")
         self.assertEquals(
-                          vpc_count_before + 1,
-                          len(vpc_list),
-                          "VPC is not created"
-                          )
+            vpc_count_before + 1,
+            len(vpc_list),
+            "VPC is not created"
+        )
         # Listing the networks for a user
-        list_networks_before = Network.list(self.userapiclient, listall=self.test_data["listall"], type="Isolated")
+        list_networks_before = Network.list(
+            self.userapiclient,
+            listall=self.test_data["listall"],
+            type="Isolated")
         # Verifying listed networks for account created at class level
-        self.assertIsNotNone(list_networks_before, "Network create failed at class level")
+        self.assertIsNotNone(
+            list_networks_before,
+            "Network create failed at class level")
         # List network offering for vpc = true
         network_offering_vpc_true_list = NetworkOffering.list(
-                                                               self.userapiclient,
-                                                               forvpc="true",
-                                                               zoneid=self.zone.id,
-                                                               guestiptype=self.test_data["network_offering_vlan"]["guestiptype"],
-                                                               supportedServices="SourceNat",
-                                                               specifyvlan=self.test_data["network_offering_vlan"]["specifyvlan"],
-                                                               state="Enabled"
-                                                               )
+            self.userapiclient,
+            forvpc="true",
+            zoneid=self.zone.id,
+            guestiptype=self.test_data["network_offering_vlan"]["guestiptype"],
+            supportedServices="SourceNat",
+            specifyvlan=self.test_data["network_offering_vlan"]["specifyvlan"],
+            state="Enabled"
+        )
         status = validateList(network_offering_vpc_true_list)
-        self.assertEquals(PASS, status[0], "Default network offering not present for vpc = true")
+        self.assertEquals(
+            PASS,
+            status[0],
+            "Default network offering not present for vpc = true")
         # If number of networks is 1, then creating network
         if len(list_networks_before) == 1:
-                network_created = Network.create(
-                                                 self.userapiclient,
-                                                 self.test_data["network_without_acl"],
-                                                 networkofferingid=network_offering_vpc_true_list[0].id,
-                                                 vpcid=vpc_1.id,
-                                                 gateway=self.test_data["ntwk"]["gateway"],
-                                                 netmask=self.test_data["ntwk"]["netmask"]
-                                                 )
-                self.assertIsNotNone(
-                                     network_created,
-                                     "Network is not created"
-                                     )
-                self.cleanup.append(network_created)
-                self.cleanup.append(vpc_1)
-                # Creating expected and actual values dictionaries
-                expected_dict = {
-                                   "id":self.test_data["network_without_acl"]["zoneid"],
-                                   "name":self.test_data["network_without_acl"]["name"],
-                                   }
-                actual_dict = {
-                                   "id":network_created.zoneid,
-                                   "name":network_created.name,
-                                   }
-                network_status = self.__verify_values(
-                                                          expected_dict,
-                                                          actual_dict
-                                                          )
-                self.assertEqual(
-                                 True,
-                                 network_status,
-                                 "Listed network details are not as expected"
-                                 )
+            network_created = Network.create(
+                self.userapiclient,
+                self.test_data["network_without_acl"],
+                networkofferingid=network_offering_vpc_true_list[0].id,
+                vpcid=vpc_1.id,
+                gateway=self.test_data["ntwk"]["gateway"],
+                netmask=self.test_data["ntwk"]["netmask"]
+            )
+            self.assertIsNotNone(
+                network_created,
+                "Network is not created"
+            )
+            self.cleanup.append(network_created)
+            self.cleanup.append(vpc_1)
+            # Creating expected and actual values dictionaries
+            expected_dict = {
+                "id": self.test_data["network_without_acl"]["zoneid"],
+                "name": self.test_data["network_without_acl"]["name"],
+            }
+            actual_dict = {
+                "id": network_created.zoneid,
+                "name": network_created.name,
+            }
+            network_status = self.__verify_values(
+                expected_dict,
+                actual_dict
+            )
+            self.assertEqual(
+                True,
+                network_status,
+                "Listed network details are not as expected"
+            )
         else:
             self.assertEqual(
-                             len(list_networks_before),
-                             1,
-                             "more than 1 network created at class level"
-                             )
+                len(list_networks_before),
+                1,
+                "more than 1 network created at class level"
+            )
         # Listing the networks
-        list_networks_after = Network.list(self.userapiclient, listall=self.test_data["listall"], type="Isolated")
+        list_networks_after = Network.list(
+            self.userapiclient,
+            listall=self.test_data["listall"],
+            type="Isolated")
         status = validateList(list_networks_after)
         self.assertEquals(PASS, status[0], "No networks found using list call")
         # Asserting for the length of the networks
         self.assertEqual(
-                         2,
-                         len(list_networks_after),
-                         "Number of networks created is not matching expected"
-                         )
+            2,
+            len(list_networks_after),
+            "Number of networks created is not matching expected"
+        )
         # Listing the networks
         list_networks_in_vpc = Network.list(
-                                            self.userapiclient,
-                                            listall=self.test_data["listall"],
-                                            vpcid=vpc_1.id,
-                                            type="Isolated"
-                                            )
+            self.userapiclient,
+            listall=self.test_data["listall"],
+            vpcid=vpc_1.id,
+            type="Isolated"
+        )
         status = validateList(list_networks_in_vpc)
         self.assertEquals(PASS, status[0], "No networks found using list call")
-        # Verify network name matches for newly created network name and name from network list
+        # Verify network name matches for newly created network name and name
+        # from network list
         self.assertEqual(
-                         network_created.name,
-                         list_networks_in_vpc[0].name,
-                         "Network names not matching"
-                         )
+            network_created.name,
+            list_networks_in_vpc[0].name,
+            "Network names not matching"
+        )
         return
 
     @attr(tags=["advanced"], required_hardware="true")
@@ -1180,80 +1302,81 @@ class TestNetworks_1(cloudstackTestCase):
             vpc_offs = vpc_offs_list[0]
         # List VPCs
         vpc_list = VPC.list(
-                            self.userapiclient,
-                            listall=self.test_data["listall"]
-                            )
+            self.userapiclient,
+            listall=self.test_data["listall"]
+        )
         # verify no vpc is present for newly created user
         status = validateList(vpc_list)
         self.assertEquals(FAIL, status[0], "VPCs found for newly created user")
-        vpc_count_before = 0
         vpc_1 = VPC.create(
-                           self.userapiclient,
-                           self.test_data["vpc"],
-                           vpcofferingid=vpc_offs.id,
-                           zoneid=self.zone.id,
-                           )
+            self.userapiclient,
+            self.test_data["vpc"],
+            vpcofferingid=vpc_offs.id,
+            zoneid=self.zone.id,
+        )
         self.assertIsNotNone(vpc_1, "VPC is not created")
         self.cleanup.append(vpc_1)
         # verify vpc is created and not none
         # Verify VPC name with test data
         self.assertNotEquals(
- -1,
-                             vpc_1.name.find(self.test_data["vpc"]["name"]),
-                             "VPC name not matched"
-                             )
+            -1,
+            vpc_1.name.find(self.test_data["vpc"]["name"]),
+            "VPC name not matched"
+        )
         # verify zone with test data
         self.assertEquals(
-                  self.zone.id,
-                  vpc_1.zoneid,
-                  "Zone is not matching in the vpc created"
-                  )
+            self.zone.id,
+            vpc_1.zoneid,
+            "Zone is not matching in the vpc created"
+        )
         # Asserting for the length of the VPCs
-        vpc_count_after = VPC.list(self.userapiclient, listall=self.test_data["listall"])
+        vpc_count_after = VPC.list(
+            self.userapiclient,
+            listall=self.test_data["listall"])
         status = validateList(vpc_count_after)
         self.assertEquals(PASS, status[0], "VPC list count is null")
         self.assertEqual(
-                         1,
-                         len(vpc_count_after),
-                         "Number of VPCs created is not matching expected"
-                         )
+            1,
+            len(vpc_count_after),
+            "Number of VPCs created is not matching expected"
+        )
         # Update VPC
         vpc_updated = VPC.update(
-                                 vpc_1,
-                                 self.userapiclient,
-                                 name="NewVPCName",
-                                 displaytext="NewVPCDisplayText",
-                                 )
+            vpc_1,
+            self.userapiclient,
+    

<TRUNCATED>