def remove_project_network(self): project_name = 'green' tenant = getattr(self, project_name, None) if tenant: servers_client = tenant['client_mgr'].servers_client dmgr.delete_all_servers(servers_client) self.disassociate_floatingip(tenant['fip1'], and_delete=True)
def delete_floatingips_and_servers(self): for net_floatingip in self.my_network['floatingips']: test_utils.call_and_ignore_notfound_exc( self.floating_ips_client.delete_floatingip, net_floatingip['id']) fip_list = self.floating_ips_client.list_floatingips()['floatingips'] if len(fip_list) > 0: time.sleep(dmgr.WAITTIME_AFTER_DISASSOC_FLOATINGIP) self.my_network['floatingips'] = [] dmgr.delete_all_servers(self.servers_client)
def remove_this_test_resources(cls): dmgr.delete_all_servers(cls.manager.servers_client) subnets_client = cls.admin_manager.subnets_client subnet_1 = cls.xnet_subnets[0] subnet_2 = cls.xnet_subnets[1] if subnet_2: subnets_client.delete_subnet(subnet_2['id']) cls.xnet_subnets[1] = None if subnet_1: subnets_client.update_subnet( subnet_1['id'], allocation_pools=subnet_1['allocation_pools']) cls.xnet_subnets[0] = None
def remove_project_network(self, from_test=True): for tn in ['green', 'red']: tenant = getattr(self, tn, None) if tenant and 'fip1' in tenant: servers_client = tenant['client_mgr'].servers_client dmgr.delete_all_servers(servers_client) fip_client = tenant['client_mgr'].floating_ips_client self.disassociate_floatingip(tenant['fip1'], client=fip_client, and_delete=True) self.disassociate_floatingip(tenant['fip2'], client=fip_client, and_delete=True) tenant.pop('fip1')
def remove_project_network(self, from_test=True): router_id = self.p_router['id'] for tn in ['yellow', 'blue']: tenant = getattr(self, tn, None) if tenant and 'fip' in tenant: servers_client = tenant['client_mgr'].servers_client dmgr.delete_all_servers(servers_client) fip_client = tenant['client_mgr'].floating_ips_client self.disassociate_floatingip(tenant['fip'], client=fip_client, and_delete=True) tenant.pop('fip') self.router_interface_delete( router_id, tenant['subnet']['id'], self.admin_manager.routers_client) self.admin_manager.networks_client.delete_network( tenant['network']['id']) tenant.pop('subnet') tenant.pop('network') self._router_clear_gateway( router_id, client=self.admin_manager.routers_client)
def resource_cleanup(cls): # lately, server up and down take long time. let's delete servers # before test's auto cleanup kickin. dmgr.delete_all_servers(cls.servers_client) super(TestDnsSearchDomainBasicOps, cls).resource_cleanup()