You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by gi...@apache.org on 2014/05/19 14:45:03 UTC

[5/7] Revert "CLOUDSTACK-6282 - Divided test_escalations.py into individual files based on functionality and added automed tests for Public IP Addresses"

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/d43d28ee/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
deleted file mode 100644
index 23dd76b..0000000
--- a/test/integration/component/test_escalations_ipaddresses.py
+++ /dev/null
@@ -1,4192 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements.  See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership.  The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License.  You may obtain a copy of the License at
-#
-#   http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied.  See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-#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 nose.plugins.attrib import attr
-from time import sleep
-
-class TestIpAddresses(cloudstackTestCase):
-
-    @classmethod
-    def setUpClass(cls):
-        try:
-            cls._cleanup = []
-            cls.testClient = super(TestIpAddresses, cls).getClsTestClient()
-            cls.api_client = cls.testClient.getApiClient()
-            cls.services = 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.template = get_template(
-                                cls.api_client,
-                                cls.zone.id,
-                                cls.services["ostype"]
-                                )
-            if cls.zone.localstorageenabled:
-                cls.storagetype = 'local'
-                cls.services["service_offerings"]["tiny"]["storagetype"] = 'local'
-            else:
-                cls.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"]["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._cleanup.append(cls.service_offering)
-            cls.services['mode'] = cls.zone.networktype
-            cls.account = Account.create(
-                                cls.api_client,
-                                cls.services["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._cleanup.append(cls.account)
-        except Exception as e:
-            cls.tearDownClass()
-            raise Exception("Warning: Exception in setup : %s" % e)
-        return
-
-    def setUp(self):
-
-        self.apiClient = self.testClient.getApiClient()
-        self.cleanup = []
-
-    def tearDown(self):
-        #Clean up, terminate the created volumes
-        cleanup_resources(self.apiClient, self.cleanup)
-        return
-
-    @classmethod
-    def tearDownClass(cls):
-        try:
-            cleanup_resources(cls.api_client, cls._cleanup)
-        except Exception as e:
-            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.
-               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
-               If not making return flag to False
-        Step4: returning the return flag after all the values are verified
-        """
-        return_flag = True
-
-        if len(expected_vals) != len(actual_vals):
-            return False
-
-        keys = expected_vals.keys()
-        for i in range(0, len(expected_vals)):
-            exp_val = expected_vals[keys[i]]
-            act_val = actual_vals[keys[i]]
-            if exp_val == act_val:
-                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
-                                                                                          ))
-        return return_flag
-
-    @attr(tags=["advanced", "provisioning"])
-    def test_01_list_ipaddresses_pagination(self):
-        """  
-        @summary: Test List IP Addresses pagination
-        @Steps:
-        Step1: Creating a network for the user
-        Step2: Listing all the IP Addresses for a user
-        Step3: Verifying that no IP Addresses are listed
-        Step4: Associating (pagesize + 1) number of IP Addresses
-        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)
-        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
-        Step12: Listing for the IP Addresses on page 2
-        Step13: Verifying that no IP Addresses are listed
-        """
-        # Listing all the networks available
-        networks_list_before = Network.list(
-                                            self.userapiclient,
-                                            forvpc="false",
-                                            domainid=self.domain.id,
-                                            account=self.account.name,
-                                            )
-        self.assertIsNone(
-                          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
-                                                      )
-        status = validateList(network_offerings_list)
-        self.assertEquals(
-                          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.assertIsNotNone(
-                             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,
-                                           )
-        status = validateList(networks_list_after)
-        self.assertEquals(
-                          PASS,
-                          status[0],
-                          "Network Creation Failed"
-                          )
-        self.assertEquals(
-                          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.assertIsNone(
-                          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.assertIsNotNone(
-                                 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"]
-                                                      )
-        status = validateList(list_ipaddresses_after)
-        self.assertEquals(
-                          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"
-                         )
-        # Listing IP Address in page 1
-        list_ipaddress_page1 = PublicIPAddress.list(
-                                                    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"
-                          )
-        # 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"
-                          )
-        # Listing IP Address in page 2
-        list_ipaddress_page2 = PublicIPAddress.list(
-                                                    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"
-                          )
-        # Verifying that List size is equal to 1
-        self.assertEquals(
-                          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"]
-                                                    )
-        # Verifying that no IP Addresses are listed
-        self.assertIsNone(
-                          list_ipaddress_page2,
-                          "Disassociation of IP Address Failed"
-                          )
-        return
- 
-    @attr(tags=["advanced", "provisioning"])
-    def test_02_list_ipaddresses_byid(self):
-        """  
-        @summary: Test List IP Addresses details by ID
-        @Steps:
-        Step1: Creating a network for the user
-        Step2: Listing all the IP Addresses for a user
-        Step3: Verifying that no IP Addresses are listed
-        Step4: Associating an IP Addresses for Network
-        Step5: Listing all the IP Addresses again
-        Step6: Verifying the length of the IP Addresses is 1
-        Step7: Listing  the IP Addresses by Id
-        Step8: Verifying that the length of the IP Addresses list is 1
-        Step9: Verifying the details of the Listed IP Address
-        """
-        # Listing all the networks available
-        networks_list_before = Network.list(
-                                            self.userapiclient,
-                                            forvpc="false",
-                                            domainid=self.domain.id,
-                                            account=self.account.name,
-                                            )
-        self.assertIsNone(
-                          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
-                                                      )
-        status = validateList(network_offerings_list)
-        self.assertEquals(
-                          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.assertIsNotNone(
-                             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,
-                                           )
-        status = validateList(networks_list_after)
-        self.assertEquals(
-                          PASS,
-                          status[0],
-                          "Network Creation Failed"
-                          )
-        self.assertEquals(
-                          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
-                                         )
-        status = validateList(network_list_byid)
-        self.assertEquals(
-                          PASS,
-                          status[0],
-                          "Failed to list Network by Id"
-                          )
-        self.assertEquals(
-                          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.assertIsNone(
-                          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.assertIsNotNone(
-                             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"]
-                                                      )
-        status = validateList(list_ipaddresses_after)
-        self.assertEquals(
-                          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"
-                         )
-        # Listing IP Address by id
-        list_ipaddress_byid = PublicIPAddress.list(
-                                                   self.userapiclient,
-                                                   id=associated_ipaddress.ipaddress.id
-                                                    )
-        status = validateList(list_ipaddress_byid)
-        self.assertEquals(
-                          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
-        # 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
-                         }
-        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
-                       }
-        ipaddress_status = self.__verify_values(
-                                                expected_dict,
-                                                actual_dict
-                                                )
-        self.assertEqual(
-                         True,
-                         ipaddress_status,
-                         "Listed IP Address details are not as expected"
-                         )
-        return
- 
-    @attr(tags=["advanced", "provisioning"])
-    def test_03_associate_ipaddress_for_vpc(self):
-        """  
-        @summary: Test to Associate IP Address for VPC
-        @Steps:
-        Step1: Creating a VPC for the user
-        Step2: Listing all the IP Addresses for a user
-        Step3: Verifying that 1 IP Addresses is listed
-        Step4: Associating an IP Addresses for VPC
-        Step5: Listing all the IP Addresses again
-        Step6: Verifying the length of the IP Addresses list is 2
-        Step7: Listing  the IP Addresses by Id
-        Step8: Verifying that the length of the IP Addresses list is 1
-        Step9: Verifying the details of the Listed IP Address
-        """
-        # 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")
-        # Creating a vpc
-        vpc_created = VPC.create(
-                                 self.userapiclient,
-                                 self.services["vpc"],
-                                 list_vpc_offering[0].id,
-                                 self.zone.id
-                                )
-        self.assertIsNotNone(
-                             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"
-                          )
-        # Verifying the list vpc size is increased by 1
-        self.assertEquals(
-                          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"]
-                                                       )
-        status = validateList(list_ipaddresses_before)
-        self.assertEquals(
-                          PASS,
-                          status[0],
-                          "Failed to List VPC IP Address"
-                          )
-        self.assertEquals(
-                          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.assertIsNotNone(
-                             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"]
-                                                      )
-        status = validateList(list_ipaddresses_after)
-        self.assertEquals(
-                          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"
-                         )
-        # 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
-                                                   )
-        status = validateList(list_ipaddress_byid)
-        self.assertEquals(
-                          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
-        # 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
-                         }
-        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
-                       }
-        ipaddress_status = self.__verify_values(
-                                                expected_dict,
-                                                actual_dict
-                                                )
-        self.assertEqual(
-                         True,
-                         ipaddress_status,
-                         "Listed IP Address details are not as expected"
-                         )
-        return
- 
-    @attr(tags=["advanced", "provisioning"])
-    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
-        @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
-        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
-        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
-        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"]
-                                            )
-        # Verifying No Networks are listed
-        self.assertIsNone(
-                          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
-                                                      )
-        status = validateList(network_offerings_list)
-        self.assertEquals(
-                          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.assertIsNotNone(
-                             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"]
-                                                       )
-        # Verifying no IP Addresses are listed
-        self.assertIsNone(
-                          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.assertIsNotNone(
-                             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"]
-                                                      )
-        status = validateList(list_ipaddresses_after)
-        self.assertEquals(
-                          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"
-                         )
-        # Listing Load Balancer Rules for the Ip Address
-        list_lbrules_before = LoadBalancerRule.list(
-                                                    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"
-                          )
-        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.assertIsNotNone(
-                             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"],
-                         }
-        actual_dict = {
-                       "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
-                                             )
-        self.assertEqual(
-                         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
-                                                   )
-        status = validateList(list_lbrules_after)
-        self.assertEquals(
-                          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"
-                         )
-        # 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
-                                                   )
-        # Verifying no Load Balancer Rules are Listed
-        self.assertIsNone(
-                          list_lbrules_after,
-                          "Failed to delete Load Balancer Rule"
-                          )
-        return
- 
-    @attr(tags=["advanced", "provisioning"])
-    def test_05_create_delete_lbrule_forvpc(self):
-        """  
-        @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
-        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
-        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
-        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")
-        # Creating a vpc
-        vpc_created = VPC.create(
-                                 self.userapiclient,
-                                 self.services["vpc"],
-                                 list_vpc_offering[0].id,
-                                 self.zone.id
-                                )
-        self.assertIsNotNone(
-                             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"
-                          )
-        # Verifying the list vpc size is increased by 1
-        self.assertEquals(
-                          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"
-                                                              )
-        status = validateList(network_offering_vpc_true_list)
-        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.cleanup.append(network_created)
-        self.assertIsNotNone(
-                             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"]
-                                                       )
-        status = validateList(list_ipaddresses_before)
-        self.assertEquals(
-                          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"
-                          )
-        # Associating an IP Addresses to VPC created 
-        associated_ipaddress = PublicIPAddress.create(
-                                                      self.userapiclient,
-                                                      services=self.services["network"],
-                                                      vpcid=vpc_created.id
-                                                      )
-        self.assertIsNotNone(
-                             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"]
-                                                      )
-        status = validateList(list_ipaddresses_after)
-        self.assertEquals(
-                          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"
-                         )
-        # Listing Load Balancer Rules for the Ip Address
-        list_lbrules_before = LoadBalancerRule.list(
-                                                    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"
-                          )
-        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.assertIsNotNone(
-                             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"],
-                         }
-        actual_dict = {
-                       "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
-                                             )
-        self.assertEqual(
-                         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,
-                                                   )
-        status = validateList(list_lbrules_after)
-        self.assertEquals(
-                          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"
-                         )
-        # 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
-                                                   )
-        # Verifying no Load Balancer Rules are Listed
-        self.assertIsNone(
-                          list_lbrules_after,
-                          "Failed to delete Load Balancer Rule"
-                          )
-        return
- 
-    @attr(tags=["advanced", "provisioning"])
-    def test_06_update_lbrule_name(self):
-        """  
-        @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
-        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
-        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"]
-                                            )
-        # Verifying No Networks are listed
-        self.assertIsNone(
-                          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
-                                                      )
-        status = validateList(network_offerings_list)
-        self.assertEquals(
-                          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.assertIsNotNone(
-                             network,
-                             "Network creation failed"
-                             )
-        self.cleanup.append(network)
-        # Listing Networks again
-        list_networks_after = Network.list(
-                                           self.userapiclient,
-                                           listall=self.services["listall"]
-                                           )
-        status = validateList(list_networks_after)
-        self.assertEquals(
-                          PASS,
-                          status[0],
-                          "Network Creation Failed"
-                          )
-        # Verifying network list count is increased by 1
-        self.assertEquals(
-                          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"]
-                                                       )
-        # Verifying no IP Addresses are listed
-        self.assertIsNone(
-                          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.assertIsNotNone(
-                             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"]
-                                                      )
-        status = validateList(list_ipaddresses_after)
-        self.assertEquals(
-                          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"
-                         )
-        # Listing Load Balancer Rules for the Ip Address
-        list_lbrules_before = LoadBalancerRule.list(
-                                                    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"
-                          )
-        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.assertIsNotNone(
-                             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
-                                                   )
-        status = validateList(list_lbrules_after)
-        self.assertEquals(
-                          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"
-                         )
-        # Updating Load Balancer Rule Name
-        updated_lb_rule = LoadBalancerRule.update(
-                                                  lb_rule,
-                                                  self.userapiclient,
-                                                  algorithm="source",
-                                                  name="NewLBRuleName"
-                                                  )
-        self.assertIsNotNone(
-                             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,
-                         }
-        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,
-                       }
-        lbrule_status = self.__verify_values(
-                                             expected_dict,
-                                             actual_dict
-                                             )
-        self.assertEqual(
-                         True,
-                         lbrule_status,
-                         "Updated Load Balancer Rule details are not as expected"
-                         )
-        return
- 
-    @attr(tags=["advanced", "provisioning"])
-    def test_07_assign_remove_lbrule_toinstance(self):
-        """  
-        @summary: Test to Assign and Remove Load Balancer Rule to an Instance
-        @Steps:
-        Step1: Creating a Network for the user
-        Step2: Associating an IP Addresses for Network
-        Step3: Launching a VM using the network created in Step 1
-        Step4: Creating a Load Balancer Rule for IP Address associated in Step2
-        Step5: Listing Load Balancer Rule Instances for applied as true
-        Step6: Verifying no Load balancer rule instances are listed
-        Step7: Listing Load Balancer Rule Instances for applied as false
-        Step8: Verifying that list size is 1
-        Step9: Assigning the Instance to Load Balancer Rule
-        Step10: Listing Load Balancer Rule Instances for applied as true
-        Step11: Verifying list size is 1
-        Step12: Listing Load Balancer Rule Instances for applied as false
-        Step13: Verifying no Load balancer rule instances are listed
-        Step14: Removing the Load Balancer Rule assigned form Instance
-        Step15: Listing Load Balancer Rule Instances for applied as true
-        Step16: Verifying no Load balancer rule instances are listed
-        Step17: Listing Load Balancer Rule Instances for applied as false
-        Step18: Verifying that list size is 1
-        """
-        # Listing all the Networks's for a user
-        list_networks_before = Network.list(
-                                            self.userapiclient,
-                                            listall=self.services["listall"]
-                                            )
-        # Verifying No Networks are listed
-        self.assertIsNone(
-                          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
-                                                      )
-        status = validateList(network_offerings_list)
-        self.assertEquals(
-                          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.assertIsNotNone(
-                             network,
-                             "Network creation failed"
-                             )
-        # Listing all the IP Addresses for a user
-        list_ipaddresses_before = PublicIPAddress.list(
-                                                       self.userapiclient,
-                                                       listall=self.services["listall"]
-                                                       )
-        # Verifying no IP Addresses are listed
-        self.assertIsNone(
-                          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.assertIsNotNone(
-                             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"]
-                                                      )
-        status = validateList(list_ipaddresses_after)
-        self.assertEquals(
-                          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"
-                         )
-        # Launching a Virtual Machine with above created Network
-        vm_created = VirtualMachine.create(
-                                           self.userapiclient,
-                                           self.services["virtual_machine"],
-                                           accountid=self.account.name,
-                                           domainid=self.account.domainid,
-                                           networkids=network.id,
-                                           serviceofferingid=self.service_offering.id,
-                                           )
-        self.assertIsNotNone(
-                             vm_created,
-                             "Failed to launch a VM under network created"
-                             )
-        self.cleanup.append(network)
-        # Listing Virtual Machines in Running state in the network created above
-        list_vms_running = VirtualMachine.list(
-                                               self.userapiclient,
-                                               listall=self.services["listall"],
-                                               account=self.account.name,
-                                               domainid=self.domain.id,
-                                               state="Running",
-                                               networkid=network.id
-                                               )
-        status = validateList(list_vms_running)
-        self.assertEquals(
-                          PASS,
-                          status[0],
-                          "VM Created is not in Running state"
-                          )
-        # Verifying the length of the list is 1
-        self.assertEqual(
-                         1,
-                         len(list_vms_running),
-                         "VM Created is not in Running state"
-                         )
-        self.assertEquals(
-                          vm_created.id,
-                          list_vms_running[0].id,
-                          "VM Created is not in Running state"
-                          )
-        # Listing Virtual Machines in Stopped state in the network created above
-        list_vms_stopped = VirtualMachine.list(
-                                               self.userapiclient,
-                                               listall=self.services["listall"],
-                                               account=self.account.name,
-                                               domainid=self.domain.id,
-                                               state="Stopped",
-                                               networkid=network.id
-                                               )
-        # Verifying that no vms are listed
-        self.assertIsNone(
-                          list_vms_stopped,
-                          "Created VM is in Stopped state"
-                          )
-        # Listing Load Balancer Rules for the Ip Address
-        list_lbrules_before = LoadBalancerRule.list(
-                                                    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"
-                          )
-        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.assertIsNotNone(
-                             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
-                                                   )
-        status = validateList(list_lbrules_after)
-        self.assertEquals(
-                          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"
-                         )
-        # Listing Load Balancer Rule Instances for applied as true
-        list_lbruleinstance_applied_true = LoadBalancerRule.listLoadBalancerRuleInstances(
-                                                                                          self.userapiclient,
-                                                                                          id=lb_rule.id,
-                                                                                          applied="true"
-                                                                                          )
-        # Verifying No Instances are assigned to the Load Balancer Rule
-        self.assertIsNone(
-                          list_lbruleinstance_applied_true,
-                          "Instances are assigned to Newly created Load Balancer Rule"
-                          )
-        # Listing Load Balancer Rule Instances for applied as false
-        list_lbruleinstance_applied_false = LoadBalancerRule.listLoadBalancerRuleInstances(
-                                                                                          self.userapiclient,
-                                                                                          id=lb_rule.id,
-                                                                                          applied="false"
-                                                                                          )
-        status = validateList(list_lbruleinstance_applied_false)
-        self.assertEquals(
-                          PASS,
-                          status[0],
-                          "No Instances are available to assign to Load Balancer Rule"
-                          )
-        # Verifying the length of the list is 1
-        self.assertEqual(
-                         1,
-                         len(list_lbruleinstance_applied_false),
-                         "No Instances are available to assign to Load Balancer Rule"
-                         )
-        # Verifying that Instance created above is listed
-        self.assertEquals(
-                          vm_created.id,
-                          list_lbruleinstance_applied_false[0].id,
-                          "Failed to list Instance available to asign a Load Balancer Rule"
-                          )
-        # Assigning Instance created to Load Balancer Rule
-        LoadBalancerRule.assign(
-                                lb_rule,
-                                self.userapiclient,
-                                vms=[vm_created]
-                                )
-        # Listing Load Balancer Rule Instances for applied as true
-        list_lbruleinstance_applied_true = LoadBalancerRule.listLoadBalancerRuleInstances(
-                                                                                          self.userapiclient,
-                                                                                          id=lb_rule.id,
-                                                                                          applied="true"
-                                                                                          )
-        status = validateList(list_lbruleinstance_applied_false)
-        self.assertEquals(
-                          PASS,
-                          status[0],
-                          "No Instances are available to assign to Load Balancer Rule"
-                          )
-        # Verifying the length of the list is 1
-        self.assertEqual(
-                         1,
-                         len(list_lbruleinstance_applied_false),
-                         "No Instances are available to assign to Load Balancer Rule"
-                         )
-        # Verifying Instances is assigned to the Load Balancer Rule
-        self.assertEquals(
-                          vm_created.id,
-                          list_lbruleinstance_applied_true[0].id,
-                          "Failed to assign Load Balancer Rule to given Instance"
-                          )
-        # Listing Load Balancer Rule Instances for applied as false
-        list_lbruleinstance_applied_false = LoadBalancerRule.listLoadBalancerRuleInstances(
-                                                                                          self.userapiclient,
-                                                                                          id=lb_rule.id,
-                                                                                          applied="false"
-                                                                                          )
-        # Verifying No Load Balancer Rules Instances are available to assign
-        self.assertIsNone(
-                          list_lbruleinstance_applied_false,
-                          "Instances are available for assigning a Load Balancer Rule"
-                          )
-        # Removing Load balancer Rule from Instance
-        LoadBalancerRule.remove(
-                                lb_rule,
-                                self.userapiclient,
-                                vms=[vm_created]
-                                )
-        # Listing Load Balancer Rule Instances for applied as true
-        list_lbruleinstance_applied_true = LoadBalancerRule.listLoadBalancerRuleInstances(
-                                                                                          self.userapiclient,
-                                                                                          id=lb_rule.id,
-                                                                                          applied="true"
-                                                                                          )
-        # Verifying that there are no Instances assigned to the Load Balancer Rule
-        self.assertIsNone(
-                          list_lbruleinstance_applied_true,
-                          "Instances is assigned to Load balancer Rule"
-                          )
-        # Listing Load Balancer Rule Instances for applied as false
-        list_lbruleinstance_applied_false = LoadBalancerRule.listLoadBalancerRuleInstances(
-                                                                                          self.userapiclient,
-                                                                                          id=lb_rule.id,
-                                                                                          applied="false"
-                                                                                          )
-        status = validateList(list_lbruleinstance_applied_false)
-        self.assertEquals(
-                          PASS,
-                          status[0],
-                          "No Instances are available to assign to Load Balancer Rule"
-                          )
-        # Verifying the length of the list is 1
-        self.assertEqual(
-                         1,
-                         len(list_lbruleinstance_applied_false),
-                         "No Instances are available to assign to Load Balancer Rule"
-                         )
-        # Verifying that Instance created above is listed
-        self.assertEquals(
-                          vm_created.id,
-                          list_lbruleinstance_applied_false[0].id,
-                          "Failed to list Instance available to asign a Load Balancer Rule"
-                          )
-        # Destroying the VM Launched
-        vm_created.delete(self.userapiclient)
-        vm_created.expung(self.apiClient)
-        return
- 
-    @attr(tags=["advanced", "provisioning"])
-    def test_08_list_create_delete_lbsticky_policy(self):
-        """  
-        @summary: Test to List, Create, Delete Load Balancer Stickyness Policy
-        @Steps:
-        Step1: Creating a Network for the user
-        Step2: Associating an IP Addresses for Network
-        Step3: Creating a Load Balancer Rule for IP Address associated in Step2
-        Step4: Listing Load Balancer Sticky Policies for LB Rule created in Step3
-        Step5: Verifying that no Load Balancer Sticky Policies are listed
-        Step6: Creating a Load Balancer Sticky Policies for LB Rule created in Step3
-        Step7: Listing Load Balancer Sticky Policies for LB Rule created in Step3
-        Step8: Verifying 1 Load Balancer Sticky Policy is listed
-        Step9: Deleting the Load Balancer Sticky Policies
-        Step10: Listing Load Balancer Sticky Policies for LB Rule created in Step3
-        Step11: Verifying that no Load Balancer Sticky Policies are listed
-        """
-        # Listing all the Networks's for a user
-        list_networks_before = Network.list(
-                                            self.userapiclient,
-                                            listall=self.services["listall"]
-                                            )
-        # Verifying No Networks are listed
-        self.assertIsNone(
-                          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
-                                                      )
-        status = validateList(network_offerings_list)
-        self.assertEquals(
-                          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.assertIsNotNone(
-                             network,
-                             "Network creation failed"
-                             )
-        self.cleanup.append(network)
-        # Listing Networks again
-        list_networks_after = Network.list(
-                                           self.userapiclient,
-                                           listall=self.services["listall"]
-                                           )
-        status = validateList(list_networks_after)
-        self.assertEquals(
-                          PASS,
-                          status[0],
-                          "Network Creation Failed"
-                          )
-        # Verifying network list count is increased by 1
-        self.assertEquals(
-                          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"]
-                                                       )
-        # Verifying no IP Addresses are listed
-        self.assertIsNone(
-                          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.assertIsNotNone(
-                             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"]
-                                                      )
-        status = validateList(list_ipaddresses_after)
-        self.assertEquals(
-                          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"
-                         )
-        # Listing Load Balancer Rules for the Ip Address
-        list_lbrules_before = LoadBalancerRule.list(
-                                                    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"
-                          )
-        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.assertIsNotNone(
-                             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
-                                                   )
-        status = validateList(list_lbrules_after)
-        self.assertEquals(
-                          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"
-                         )
-        # Listing Load Balancer Stickyness Policies for LB Rule
-        list_lbstickypolicy_before = LoadBalancerRule.listStickyPolicies(
-                                                                         self.userapiclient,
-                                                                         lbruleid=lb_rule.id,
-                                                                         listall=self.services["listall"]
-                                                                         )
-        # Verifying no Sticky Policies are listed
-        self.assertEquals(
-                          0,
-                          len(list_lbstickypolicy_before[0].stickinesspolicy),
-                          "Sticky Policy listed for newly created Load Balancer Rule"
-                          )
-        # Creating a Sticy Policy for Load Balancer Rule
-        sticky_policy = LoadBalancerRule.createSticky(
-                                                      lb_rule,
-                                                      self.userapiclient,
-                                                      methodname='LbCookie',
-                                                      name='LbCookieSticky'
-                                                      )
-        self.assertIsNotNone(
-                             sticky_policy,
-                             "Failed to create Sticky Policy for Load Balancer Rule"
-                             )
-

<TRUNCATED>