cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From wid...@apache.org
Subject [44/50] [abbrv] CLOUDSTACK-7603: Fixed test_escalations_network.py - test suite should use its own vpc offering
Date Sun, 28 Sep 2014 09:40:44 GMT
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>

Mime
View raw message